summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/branches/java-post-M1/das
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:11:48 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:11:48 +0000
commitece4fd35da7b7fc76264776f81705e6b5b52d3e0 (patch)
tree962794e2a2b1ab91a02c41e4927a527cade83959 /sca-java-1.x/branches/java-post-M1/das
parent76e9f96ca7f494088fe3af5a46ad0d153e961008 (diff)
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835140 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/branches/java-post-M1/das')
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/pom.xml34
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/pom.xml128
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Command.java67
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ConfigHelper.java73
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Converter.java52
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/DAS.java53
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/DASFactory.java74
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Pager.java62
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/MappingWrapper.java380
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/QualifiedColumn.java41
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/RelationshipWrapper.java44
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/TableWrapper.java126
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/BaseGenerator.java18
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/DeleteGenerator.java80
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/InsertGenerator.java147
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/UpdateGenerator.java192
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java116
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DefaultConverter.java91
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/GraphBuilderMetadata.java100
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/MultiTableRegistry.java105
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java286
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetProcessor.java137
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetRow.java169
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/RowObjects.java140
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/SingleTableRegistry.java52
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java75
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableRegistry.java43
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ESchemaMaker.java203
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ResultSetTypeMap.java133
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ApplyChangesCommandImpl.java93
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/BaseCommandImpl.java48
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeFactory.java183
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeOperation.java78
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeSummarizer.java239
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Changes.java80
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandImpl.java100
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java95
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CreateOperation.java29
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASFactoryImpl.java53
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASImpl.java234
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DatabaseObject.java148
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteCommandImpl.java32
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteList.java72
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteOperation.java38
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/FactoryRegistry.java49
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertCommandImpl.java75
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertList.java82
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ManagedParameterImpl.java17
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/OptimisticWriteCommandImpl.java52
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/PagerImpl.java64
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterImpl.java126
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Parameters.java110
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/QueryString.java86
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ReadCommandImpl.java127
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ResultSetShape.java118
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypeHelper.java102
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypes.java64
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SPCommandImpl.java93
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Statement.java210
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateCommandImpl.java32
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateList.java42
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateOperation.java30
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/WriteCommandImpl.java101
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/merge/impl/GraphMerger.java166
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/ConfigUtil.java51
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DataObjectUtil.java73
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DebugFormatter.java34
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DebugUtil.java66
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/META-INF/LICENSE.txt1277
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/META-INF/MANIFEST.MF13
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/META-INF/NOTICE18
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/META-INF/README.txt35
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/config.xsd109
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/dasmodel4.mdl4622
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/AliasTests.java136
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/BestPracticeTests.java143
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CUDGeneration.java111
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java176
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java101
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyTests.java95
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java102
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java307
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java316
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java106
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java137
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedCommandTests.java92
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedId.java262
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GraphMergeTests.java150
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/NameMappingTests.java65
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OCCTests.java102
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OneToOneRelationshipTests.java155
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OperationOrderingTests.java78
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/Paging.java105
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PartialUpdateTests.java97
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PassiveConnectionTests.java92
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ProgrammaticConfigTests.java146
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ReadDBSchemaTests.java62
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RecursiveTests.java69
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java109
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ResultSetShapeTests.java91
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SerializationTests.java90
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SimplestCrud.java235
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/StoredProcs.java186
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TopDown.java73
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TypeTests.java91
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersByLastnameCommand.java54
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersCommand.java55
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java60
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersWithShapeCommand.java58
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/SimpleReadCustomersWithShapeCommand.java79
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/BookData.java45
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CityData.java54
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyData.java45
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyDeptData.java42
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyEmpData.java44
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CustomerData.java45
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepEmpData.java45
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java41
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/EmployeeData.java45
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderData.java42
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsData.java43
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/PartData.java52
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/StateData.java51
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/TypesData.java64
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DB2Setup.java35
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DasTest.java152
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DatabaseSetup.java238
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DerbySetup.java42
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/JavaStoredProcs.java79
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/MySQLSetup.java95
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/RelationshipData.java81
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestData.java87
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestDataWithExplicitColumns.java82
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/IntegerToBooleanConverter.java40
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/SillyDateStringConverter.java73
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToIntegerConverter.java37
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToLongConverter.java35
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllCommonTests.java100
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDB2.java39
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDerby.java34
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsMySQL.java34
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/typed/SimplestStaticCrud.java56
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/1xM_mapping_no_cud.xml34
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/BooksConfig.xml27
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/BooksConfigWithAlias.xml33
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CompanyConfig.xml40
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CompanyEmployeeConfig.xml51
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CustOrdersConnectionProps.xml58
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CustomerConfigWithConverter.xml31
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CustomerConfigWithIDConverter.xml29
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CustomersOrdersConfig.xml45
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/InvalidConfig1.xml30
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/ManagedBooksConfig.xml27
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/OrdersOrderDetailsConfig.xml33
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/PartsConfig.xml47
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCompanyDepartmentMapping.xml36
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCompanyMapping.xml22
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCustomerMapping.xml26
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCustomerMappingWithCUD.xml25
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCustomerMappingWithCUD2.xml28
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCustomerMappingWithInvalidCUD.xml29
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCustomerOrderMapping.xml32
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicStaticCustomer.xml27
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/cityStates.xml37
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/company.ecore130
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/company.genmodel38
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/company.xsd45
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/companyMapping.xml39
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/companyMappingWithConverters.xml43
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/customer.ecore96
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/customer.genmodel32
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/customer.xsd40
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/customerMapping.xml25
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/customerOrderRelationshipMapping.xml31
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/passiveConnection.xml23
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/staticCustomer.xml22
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/staticCustomerOrder.xml35
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/staticInvalid.xml22
-rw-r--r--sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/storedProcTest.xml24
179 files changed, 20562 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/java-post-M1/das/pom.xml b/sca-java-1.x/branches/java-post-M1/das/pom.xml
new file mode 100644
index 0000000000..98da287328
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/pom.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-project</artifactId>
+ <version>incubating-M1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.das</groupId>
+ <artifactId>tuscany-das</artifactId>
+ <packaging>pom</packaging>
+ <name>Tuscany DAS</name>
+ <version>incubating-M1</version>
+
+ <modules>
+ <module>rdb</module>
+ </modules>
+
+</project>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/pom.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/pom.xml
new file mode 100644
index 0000000000..92ae7c42ef
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/pom.xml
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.das</groupId>
+ <artifactId>tuscany-das</artifactId>
+ <version>incubating-M1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-das-rdb</artifactId>
+ <name>Tuscany DAS for Relational Databases</name>
+ <version>incubating-M1</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>commonj</groupId>
+ <artifactId>sdo-api</artifactId>
+ <version>incubating-M1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.1.2.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>config</id>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/config.xsd</schemaFile>
+ <generateLoader>true</generateLoader>
+ <generateSwitch>true</generateSwitch>
+ <noNotification>true</noNotification>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>company</id>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/company.xsd</schemaFile>
+ <generateLoader>true</generateLoader>
+ <generateSwitch>true</generateSwitch>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>customer</id>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/customer.xsd</schemaFile>
+ <generateLoader>true</generateLoader>
+ <generateSwitch>true</generateSwitch>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/*AllTestsDerby.java</include>
+ </includes>
+ <reportFormat>brief</reportFormat>
+ <useFile>false</useFile>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
+
+
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Command.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Command.java
new file mode 100644
index 0000000000..9987b7634d
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Command.java
@@ -0,0 +1,67 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb;
+
+import commonj.sdo.DataObject;
+
+/**
+ * A Command is used to execute a read or write to a database
+ */
+public interface Command {
+
+ /**
+ * Performs the function defined by the command
+ */
+ public void execute();
+
+ /**
+ * Performs the function defined by the command and return the results in
+ * the root DataObject
+ *
+ * @return the root DataObject
+ */
+ public DataObject executeQuery();
+
+ /**
+ * Sets the value of the associated Parameter
+ *
+ * @param index
+ * the index of the Parameter
+ * @param value
+ * the value for the Parameter
+ */
+ public void setParameter(int index, Object value);
+
+ /**
+ * Returns the value of the associated Parameter
+ *
+ * @param index
+ * the index of the Parameter
+ * @return the value of the Parameter
+ */
+ public Object getParameter(int index);
+
+
+ /**
+ * Returns the value of the database-generated key. This method is specific to an "insert"
+ * command and will be valid only after the command has been executed.
+ *
+ * @return the generated key
+ */
+ public int getGeneratedKey();
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ConfigHelper.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ConfigHelper.java
new file mode 100644
index 0000000000..3cacd28a69
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ConfigHelper.java
@@ -0,0 +1,73 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb;
+
+import org.apache.tuscany.das.rdb.config.Config;
+import org.apache.tuscany.das.rdb.config.ConfigFactory;
+import org.apache.tuscany.das.rdb.config.impl.ConfigFactoryImpl;
+import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper;
+
+/**
+ * A ConfigHelper is used as an aid in programmatic construction of Config instances.
+ * Manual contrution fo COnfig is an alternative to providing needed configuration
+ * information in an XML file
+ *
+ */public class ConfigHelper {
+
+ private Config config;
+
+ private MappingWrapper configWrapper;
+
+ private ConfigFactory factory = ConfigFactoryImpl.eINSTANCE;
+
+ public ConfigHelper() {
+ config = factory.createConfig();
+ configWrapper = new MappingWrapper(config);
+ }
+
+ public ConfigHelper(Config config) {
+ this.config = config;
+ configWrapper = new MappingWrapper(config);
+ }
+
+ public Config newInstance() {
+ return factory.createConfig();
+ }
+
+ public void addPrimaryKey(String columnName) {
+ configWrapper.addPrimaryKey(columnName);
+ }
+
+ public void addRelationship(String parentName, String childName) {
+ configWrapper.addRelationship(parentName, childName);
+ }
+
+ public void addTable(String name, String propertyName) {
+ configWrapper.addTable(name, propertyName);
+ }
+
+ public void addUpdateStatement(String statement, String tableName, String parameters) {
+ configWrapper.addUpdateCommand(tableName, statement, parameters);
+ }
+
+
+
+ public Config getConfig() {
+ return config;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Converter.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Converter.java
new file mode 100644
index 0000000000..eb1ed24230
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Converter.java
@@ -0,0 +1,52 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb;
+
+/**
+ * A lightweight Table-column <--> DataObject-property converter framework.
+ * Converters allow a user to insert a transformation between a column value and
+ * is destination DataObject property value. For example, by default, a VARCHAR
+ * column will be represented as a String in its corresponding DataObject
+ * property. A user could insert a converter that transforms the the VARCHAR
+ * value to an Integer. If this is done then although the column returns
+ * character data, the DataObject property will be an Integer
+ *
+ *
+ */
+public interface Converter {
+
+ /**
+ * Transform the columnData object to a new value and possibly new type.
+ * This should be the invers operation of #getColumnValue
+ *
+ * @param columnData
+ * The column value to transorm
+ * @return Returns the transformed value
+ */
+ public Object getPropertyValue(Object columnData);
+
+ /**
+ * Transform the columnData object to a new value and possibly new type.
+ * This should be the invers operation of #getPropertyValue
+ *
+ * @param propertyData
+ * The property value to transform
+ * @return Returns the transformed value
+ */
+ public Object getColumnValue(Object propertyData);
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/DAS.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/DAS.java
new file mode 100644
index 0000000000..24c39f5add
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/DAS.java
@@ -0,0 +1,53 @@
+package org.apache.tuscany.das.rdb;
+
+import org.apache.tuscany.das.rdb.impl.DASFactoryImpl;
+
+import commonj.sdo.DataObject;
+
+/**
+ * A CommandGroup represents a set of {@link Command} and single
+ * {@link ApplyChangesCommand} that are created from a common config file.
+ *
+ *
+ */
+public interface DAS {
+
+ public static DASFactory FACTORY = new DASFactoryImpl();
+
+ /**
+ * The change history is scanned and modifications to the graph of data
+ * objects are flushed to the database.
+ *
+ * @param root
+ * the topmost containing data object
+ */
+ public void applyChanges(DataObject root);
+
+
+ /**
+ * Gets the named command from this factory's inventory
+ *
+ * @param name
+ * The identifying name of the requested command
+ * @return Returns the identified command
+ */
+ public Command getCommand(String name);
+
+
+ /**
+ * If the CommandGroup is managing connections then this method
+ * must be called when the client is done with the instance.
+ *
+ */
+ public void releaseResources();
+
+ /**
+ * Creates a Command based on the provided SQL statement
+ *
+ * @param sql
+ * The SQL statement
+ * @return returns a Command instance
+ */
+ public Command createCommand(String sql);
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/DASFactory.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/DASFactory.java
new file mode 100644
index 0000000000..32e9b065ab
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/DASFactory.java
@@ -0,0 +1,74 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb;
+
+import java.io.InputStream;
+import java.sql.Connection;
+
+import org.apache.tuscany.das.rdb.config.Config;
+
+/**
+ * A DASFactory produces {@link DAS} instances.
+ *
+ *
+ */
+public interface DASFactory {
+
+ /**
+ * Creates a DAS based on the provided config file stream
+ *
+ * @param configStream
+ * A stream over a DAS config file
+ * @return returns a DAS instance
+ */
+ public DAS createDAS(InputStream configStream);
+
+ /**
+ * Creates a DAS based on the provide config file stream and connection
+ * @param configStream
+ * @param connection
+ * @return
+ */
+ public DAS createDAS(InputStream configStream, Connection connection);
+
+ /**
+ * Creates a DAS based on the provided config
+ *
+ * @param config
+ * A DAS config object
+ * @return returns a DAS instance
+ */
+ public DAS createDAS(Config config);
+
+ /**
+ * Creates a DAS based on the provided config and connection
+ * @param config
+ * @param connection
+ * @return
+ */
+ public DAS createDAS(Config config, Connection connection);
+
+ /**
+ * Creates a DAS based on the provided connection
+ * @param connection
+ * @return
+ */
+ public DAS createDAS(Connection connection);
+
+
+}
+
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Pager.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Pager.java
new file mode 100644
index 0000000000..4edb447e31
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Pager.java
@@ -0,0 +1,62 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb;
+
+import commonj.sdo.DataObject;
+
+/**
+ * An iterator-like interface to conveniently move through chunks of data. The
+ * idea is that a Pager works with a read Command. The read command returns a
+ * large amount of data and the client wants to work with chunks of it at a
+ * time. So the Pager is created on the command and each call to next returns
+ * the next chunk of data. This is done completely disconnected. No cursor is
+ * maintained between calls to #next.
+ *
+ * TODO - This is very preliminary. We need to look at this interface in the
+ * context of disonnected scenarios such as a web app. The Pager instance will
+ * probably be saved in session so it must be very light and cannot reference a
+ * connection. Also, we probably need to define a factory or add a method to set
+ * page size.
+ *
+ *
+ */
+public interface Pager {
+
+ /**
+ * Get the next page of data
+ *
+ * @return the next page of data
+ */
+ public DataObject next();
+
+ /**
+ * Get the page prior to the last page returned
+ *
+ * @return the previous page
+ */
+ public DataObject previous();
+
+ /**
+ * Return a specific identified page.
+ *
+ * @param page
+ * The number of the page to return
+ * @return the indicated page
+ */
+ public DataObject getPage(int page);
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/MappingWrapper.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/MappingWrapper.java
new file mode 100644
index 0000000000..b1495be4da
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/MappingWrapper.java
@@ -0,0 +1,380 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.config.wrapper;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.tuscany.das.rdb.config.Column;
+import org.apache.tuscany.das.rdb.config.Config;
+import org.apache.tuscany.das.rdb.config.ConfigFactory;
+import org.apache.tuscany.das.rdb.config.KeyPair;
+import org.apache.tuscany.das.rdb.config.Relationship;
+import org.apache.tuscany.das.rdb.config.Table;
+import org.apache.tuscany.das.rdb.config.Update;
+import org.apache.tuscany.das.rdb.config.impl.ConfigFactoryImpl;
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+import commonj.sdo.Property;
+
+public class MappingWrapper {
+
+ private static final ConfigFactory factory = ConfigFactoryImpl.eINSTANCE;
+
+ private static final boolean debug = false;
+
+ private Config config;
+
+ public MappingWrapper() {
+ // Empty Constructor
+ }
+
+ public MappingWrapper(Config mapping) {
+ this.config = mapping;
+ }
+
+ public Config getConfig() {
+ return this.config;
+ }
+
+ public Table getTable(String tableName) {
+ if (config == null)
+ return null;
+ DebugUtil.debugln(getClass(), debug, "Looking for table " + tableName);
+ Iterator i = config.getTable().iterator();
+ while (i.hasNext()) {
+ Table t = (Table) i.next();
+ if (tableName.equals(t.getTableName()))
+ return t;
+ }
+
+ return null;
+ }
+
+ public Table getTableByTypeName(String typeName) {
+ if (config == null)
+ return null;
+ DebugUtil.debugln(getClass(), debug, "Looking for table by property: " + typeName);
+ Iterator i = config.getTable().iterator();
+ while (i.hasNext()) {
+ Table t = (Table) i.next();
+ TableWrapper wrapper = new TableWrapper(t);
+ if (typeName.equals(wrapper.getTypeName()))
+ return t;
+ }
+ return null;
+
+ // throw new RuntimeException("Table with property name " + name
+ // + " not found.");
+
+ }
+
+ public void addRelationship(String parentName, String childName) {
+
+ if (config == null)
+ config = factory.createConfig();
+
+ QualifiedColumn parent = new QualifiedColumn(parentName);
+ QualifiedColumn child = new QualifiedColumn(childName);
+
+ Relationship r = factory.createRelationship();
+ r.setName(child.getTableName());
+ r.setPrimaryKeyTable(parent.getTableName());
+ r.setForeignKeyTable(child.getTableName());
+ DebugUtil.debugln(getClass(), debug, "Created relationship from " + r.getPrimaryKeyTable() + " to "
+ + r.getForeignKeyTable() + " named " + r.getName());
+
+ KeyPair pair = factory.createKeyPair();
+ pair.setPrimaryKeyColumn(parent.getColumnName());
+ pair.setForeignKeyColumn(child.getColumnName());
+
+ r.getKeyPair().add(pair);
+ r.setMany(true);
+
+ config.getRelationship().add(r);
+
+ }
+
+
+
+ public void addPrimaryKey(String columnName) {
+ addPrimaryKey(Collections.singletonList(columnName));
+ }
+
+ public void addPrimaryKey(List columnNames) {
+ if (config == null)
+ config = factory.createConfig();
+
+ Iterator i = columnNames.iterator();
+ while (i.hasNext()) {
+ String columnName = (String) i.next();
+
+ QualifiedColumn pkColumn = new QualifiedColumn(columnName);
+ Table t = findOrCreateTable(pkColumn.getTableName());
+ Column c = findOrCreateColumn(t, pkColumn.getColumnName());
+ c.setPrimaryKey(true);
+ }
+ }
+
+ public String getTableTypeName(String tableName) {
+ Table t = getTable(tableName);
+ if (t == null)
+ return tableName;
+ String propertyName = t.getTypeName();
+
+ if (propertyName == null)
+ return tableName;
+
+ return propertyName;
+ }
+
+ public Column getColumn(Table t, String columnName) {
+ if (t == null)
+ return null;
+ Iterator i = t.getColumn().iterator();
+ while (i.hasNext()) {
+ Column c = (Column) i.next();
+ if (c.getColumnName().equals(columnName)) {
+ return c;
+ }
+ }
+ DebugUtil
+ .debugln(getClass(), debug, "WARNING: Could not find column " + columnName + " in table " + t.getTableName());
+ return null;
+ }
+
+ public Column getColumnByPropertyName(Table t, String propertyName) {
+ if (t == null)
+ return null;
+ Iterator i = t.getColumn().iterator();
+ while (i.hasNext()) {
+ Column c = (Column) i.next();
+ if (c.getColumnName().equals(propertyName))
+ return c;
+ if (c.getPropertyName() != null && c.getPropertyName().equals(propertyName))
+ return c;
+ }
+ DebugUtil.debugln(getClass(), debug, "WARNING: Could not find column " + propertyName + " in table "
+ + t.getTableName());
+ return null;
+ }
+
+ public String getColumnPropertyName(String tableName, String columnName) {
+ Table t = getTable(tableName);
+ Column c = getColumn(t, columnName);
+ if (c == null)
+ return columnName;
+
+ String propertyName = c.getPropertyName();
+ if (propertyName == null)
+ return c.getColumnName();
+
+ return propertyName;
+ }
+
+ public void addCollisionColumn(String columnName) {
+
+ if (config == null)
+ config = factory.createConfig();
+
+ QualifiedColumn occColumn = new QualifiedColumn(columnName);
+ Table t = findOrCreateTable(occColumn.getTableName());
+ Column c = findOrCreateColumn(t, occColumn.getColumnName());
+ c.setCollision(true);
+
+ config.getTable().add(t);
+ }
+
+ public void addTable(String tableName, String typeName) {
+ Table table = getTable(tableName);
+ if (table != null)
+ throw new RuntimeException("Table " + tableName + "already exists");
+
+ table = ConfigFactoryImpl.eINSTANCE.createTable();
+ table.setTableName(tableName);
+ table.setTypeName(typeName);
+ config.getTable().add(table);
+
+ }
+
+ private Table findOrCreateTable(String tableName) {
+ Table table = getTable(tableName);
+ if (table == null) {
+ table = ConfigFactoryImpl.eINSTANCE.createTable();
+ table.setTableName(tableName);
+ config.getTable().add(table);
+ }
+ return table;
+
+ }
+
+ private Column findOrCreateColumn(Table t, String name) {
+ Iterator i = t.getColumn().iterator();
+ while (i.hasNext()) {
+ Column c = (Column) i.next();
+ if (name.equals(c.getColumnName()))
+ return c;
+ }
+
+ Column c = ConfigFactoryImpl.eINSTANCE.createColumn();
+ c.setColumnName(name);
+ t.getColumn().add(c);
+ return c;
+ }
+
+ public boolean hasRecursiveRelationships() {
+ if (config != null) {
+ Iterator i = getConfig().getRelationship().iterator();
+ while (i.hasNext()) {
+ Relationship r = (Relationship) i.next();
+ if (r.getPrimaryKeyTable().equals(r.getForeignKeyTable()))
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public Collection getRelationshipsByChildTable(String name) {
+ ArrayList results = new ArrayList();
+ if (config != null) {
+ Iterator i = getConfig().getRelationship().iterator();
+ while (i.hasNext()) {
+ Relationship r = (Relationship) i.next();
+ if (name.equals(r.getForeignKeyTable()))
+ results.add(r);
+ }
+ }
+ return results;
+ }
+
+ // TODO optimize
+ public ArrayList getInsertOrder() {
+ DebugUtil.debugln(getClass(), debug, "Getting insert order");
+ ArrayList inserts = new ArrayList();
+ HashMap parentToChild = new HashMap();
+
+ ArrayList parents = new ArrayList();
+ ArrayList children = new ArrayList();
+ if (config != null) {
+ Iterator i = getConfig().getRelationship().iterator();
+ while (i.hasNext()) {
+ Relationship r = (Relationship) i.next();
+ parents.add(r.getPrimaryKeyTable());
+ children.add(r.getForeignKeyTable());
+ parentToChild.put(r.getPrimaryKeyTable(), r.getForeignKeyTable());
+ }
+
+ while (parents.size() > 0) {
+ String parent = (String) parents.get(0);
+ if (!children.contains(parent)) {
+ if (!inserts.contains(parent))
+ inserts.add(parent);
+
+ String child = (String) parentToChild.get(parent);
+ if (!inserts.contains(child))
+ inserts.add(child);
+
+ parents.remove(parent);
+ children.remove(child);
+ } else {
+ parents.add(parents.remove(0));
+ }
+ }
+ inserts.addAll(children);
+
+ }
+
+ DebugUtil.debugln(getClass(), debug, inserts);
+ return inserts;
+ }
+
+ public ArrayList getDeleteOrder() {
+ ArrayList deleteOrder = new ArrayList();
+ deleteOrder.addAll(getInsertOrder());
+ Collections.reverse(deleteOrder);
+ return deleteOrder;
+ }
+
+ public void addConverter(String name, String converter) {
+ if (config == null)
+ config = factory.createConfig();
+
+ QualifiedColumn column = new QualifiedColumn(name);
+ Table t = findOrCreateTable(column.getTableName());
+ Column c = findOrCreateColumn(t, column.getColumnName());
+ c.setConverterClassName(converter);
+
+ }
+
+ public String getConverter(String tableName, String columnName) {
+ Table t = getTable(tableName);
+ Column c = getColumn(t, columnName);
+ if (c != null)
+ return c.getConverterClassName();
+ return null;
+ }
+
+ public HashMap getConverters(Table table) {
+ HashMap converters = new HashMap();
+
+ Iterator columns = table.getColumn().iterator();
+ while (columns.hasNext()) {
+ Column c = (Column) columns.next();
+ if (c.getConverterClassName() != null) {
+ String property = c.getPropertyName();
+ if (property == null)
+ property = c.getColumnName();
+ converters.put(property, c.getConverterClassName());
+ }
+ }
+ return converters;
+ }
+
+ public Relationship getRelationshipByReference(Property ref) {
+ Iterator i = config.getRelationship().iterator();
+ while (i.hasNext()) {
+ Relationship r = (Relationship) i.next();
+ if (ref.getName().equals(r.getName()) || ref.getOpposite().getName().equals(r.getName()))
+ return r;
+ }
+ throw new RuntimeException("Could not find relationship " + ref.getName() + " in the configuration");
+ }
+
+ public Relationship getRelationshipByName(String name) {
+ Iterator i = config.getRelationship().iterator();
+ while (i.hasNext()) {
+ Relationship r = (Relationship) i.next();
+ if (name.equals(r.getName()))
+ return r;
+ }
+ throw new RuntimeException("Could not find relationship " + name + " in the configuration");
+ }
+
+ public void addUpdateCommand(String tableName, String statement, String parameters) {
+ Table table = findOrCreateTable(tableName);
+ Update update = ConfigFactoryImpl.eINSTANCE.createUpdate();
+ update.setSql(statement);
+ update.setParameters(parameters);
+ table.setUpdate(update);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/QualifiedColumn.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/QualifiedColumn.java
new file mode 100644
index 0000000000..6babe0c349
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/QualifiedColumn.java
@@ -0,0 +1,41 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.config.wrapper;
+
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+public class QualifiedColumn {
+
+ private final String tableName;
+ private final String columnName;
+ private static boolean debug = false;
+
+ public QualifiedColumn(String name) {
+ tableName = name.substring(0, name.indexOf('.'));
+ columnName = name.substring(name.indexOf('.') + 1);
+ DebugUtil.debugln(getClass(), debug, tableName);
+ DebugUtil.debugln(getClass(), debug, columnName);
+ }
+
+ public String getTableName() {
+ return this.tableName;
+ }
+
+ public String getColumnName() {
+ return this.columnName;
+ }
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/RelationshipWrapper.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/RelationshipWrapper.java
new file mode 100644
index 0000000000..14403367d8
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/RelationshipWrapper.java
@@ -0,0 +1,44 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.config.wrapper;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.tuscany.das.rdb.config.KeyPair;
+import org.apache.tuscany.das.rdb.config.Relationship;
+
+public class RelationshipWrapper {
+
+ private Relationship relationship;
+
+ public RelationshipWrapper(Relationship r) {
+ this.relationship = r;
+ }
+
+ public Collection getForeignKeys() {
+ ArrayList keys = new ArrayList();
+ Iterator i = this.relationship.getKeyPair().iterator();
+ while ( i.hasNext()) {
+ KeyPair pair = (KeyPair) i.next();
+ keys.add(pair.getForeignKeyColumn());
+ }
+ return keys;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/TableWrapper.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/TableWrapper.java
new file mode 100644
index 0000000000..764a0851a0
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/TableWrapper.java
@@ -0,0 +1,126 @@
+/**
+*
+* Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.tuscany.das.rdb.config.wrapper;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.tuscany.das.rdb.config.Column;
+import org.apache.tuscany.das.rdb.config.Table;
+
+public class TableWrapper {
+
+ private Table table;
+
+ public TableWrapper(Table table) {
+ this.table = table;
+ }
+
+ public String getTypeName() {
+ return table.getTypeName() == null ? table.getTableName() : table
+ .getTypeName();
+ }
+
+ public Collection getPrimaryKeyNames() {
+ ArrayList pkNames = new ArrayList();
+ Iterator i = table.getColumn().iterator();
+ while (i.hasNext()) {
+ Column c = (Column) i.next();
+ if (c.isPrimaryKey())
+ pkNames.add(c.getColumnName());
+ }
+ return pkNames;
+ }
+
+ public Collection getPrimaryKeyProperties() {
+
+ ArrayList keyProperties = new ArrayList();
+ Iterator columns = table.getColumn().iterator();
+ while (columns.hasNext()) {
+ Column c = (Column) columns.next();
+ if (c.isPrimaryKey()) {
+ keyProperties.add(getColumnPropertyName(c));
+ }
+ }
+
+ return keyProperties;
+ }
+
+ private String getColumnPropertyName(Column c) {
+ if (c.getPropertyName() != null)
+ return c.getPropertyName();
+ else
+ return c.getColumnName();
+ }
+
+ public boolean isGeneratedColumnProperty(String name) {
+ Column c = getColumnByPropertyName(name);
+ return c == null ? false : c.isGenerated();
+ }
+
+
+ public String getConverter(String propertyName) {
+ Column c = getColumnByPropertyName(propertyName);
+ return (c == null) ? null : c.getConverterClassName();
+ }
+
+ public Column getColumnByPropertyName(String propertyName) {
+ Iterator columns = table.getColumn().iterator();
+ while (columns.hasNext()) {
+ Column c = (Column) columns.next();
+ String property = c.getPropertyName();
+ if (property == null)
+ property = c.getColumnName();
+ if (propertyName.equals(property))
+ return c;
+ }
+
+ return null;
+ }
+
+ public Column getCollisionColumn() {
+ Iterator columns = table.getColumn().iterator();
+ while (columns.hasNext()) {
+ Column c = (Column) columns.next();
+ if ( c.isCollision() )
+ return c;
+ }
+
+ return null;
+
+ }
+
+ public String getCollisionColumnPropertyName() {
+ Column c = getCollisionColumn();
+ if ( c.getPropertyName() != null )
+ return c.getPropertyName();
+ else
+ return c.getColumnName();
+ }
+
+ public String getManagedColumnPropertyName() {
+ Iterator i = table.getColumn().iterator();
+ while (i.hasNext()) {
+ Column c = (Column) i.next();
+ if (c.isManaged())
+ return c.getPropertyName() == null ? c.getColumnName() : c.getPropertyName();
+ }
+ return null;
+
+ }
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/BaseGenerator.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/BaseGenerator.java
new file mode 100644
index 0000000000..50beec06d7
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/BaseGenerator.java
@@ -0,0 +1,18 @@
+package org.apache.tuscany.das.rdb.generator.impl;
+
+import org.apache.tuscany.das.rdb.Converter;
+
+public class BaseGenerator {
+
+ protected Converter getConverter(String converter) {
+ if ( converter != null ) {
+ try {
+ return (Converter) Thread.currentThread().getContextClassLoader().loadClass(converter).newInstance();
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/DeleteGenerator.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/DeleteGenerator.java
new file mode 100644
index 0000000000..c83032698a
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/DeleteGenerator.java
@@ -0,0 +1,80 @@
+/**
+*
+* Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.tuscany.das.rdb.generator.impl;
+
+import java.util.Iterator;
+
+import org.apache.tuscany.das.rdb.config.Table;
+import org.apache.tuscany.das.rdb.config.wrapper.TableWrapper;
+import org.apache.tuscany.das.rdb.impl.DeleteCommandImpl;
+import org.apache.tuscany.das.rdb.impl.ParameterImpl;
+import org.apache.tuscany.das.rdb.impl.SDODataTypes;
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+public class DeleteGenerator extends BaseGenerator {
+
+ public static final DeleteGenerator instance = new DeleteGenerator();
+
+ private static final boolean debug = false;
+
+ private DeleteGenerator() {
+ super();
+ }
+
+ private String getDeleteStatement(Table t) {
+ TableWrapper table = new TableWrapper(t);
+
+ StringBuffer statement = new StringBuffer();
+ statement.append("delete from ");
+ statement.append(t.getTableName());
+ statement.append(" where ");
+
+ Iterator names = table.getPrimaryKeyNames().iterator();
+ Iterator properties = table.getPrimaryKeyProperties().iterator();
+ while (names.hasNext() && properties.hasNext()) {
+ String name = (String) names.next();
+ statement.append(name);
+ statement.append(" = ?");
+ if (names.hasNext() && properties.hasNext())
+ statement.append(" and ");
+ }
+
+ DebugUtil.debugln(getClass(), debug, statement.toString());
+ return statement.toString();
+ }
+
+ public DeleteCommandImpl getDeleteCommand(Table t) {
+ TableWrapper tw = new TableWrapper(t);
+ DeleteCommandImpl deleteCommand = new DeleteCommandImpl(getDeleteStatement(t));
+
+ Iterator i = tw.getPrimaryKeyProperties().iterator();
+ for(int idx=1; i.hasNext(); idx++) {
+ String property = (String) i.next();
+ ParameterImpl p = new ParameterImpl();
+ p.setName(property);
+ p.setType(SDODataTypes.OBJECT);
+ p.setConverter(getConverter(tw.getConverter(property)));
+ p.setIndex(idx);
+ deleteCommand.addParameter(p);
+ }
+ return deleteCommand;
+ }
+
+
+
+}
+
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/InsertGenerator.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/InsertGenerator.java
new file mode 100644
index 0000000000..183d1800d5
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/InsertGenerator.java
@@ -0,0 +1,147 @@
+/**
+*
+* Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.tuscany.das.rdb.generator.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.tuscany.das.rdb.config.Relationship;
+import org.apache.tuscany.das.rdb.config.Table;
+import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper;
+import org.apache.tuscany.das.rdb.config.wrapper.RelationshipWrapper;
+import org.apache.tuscany.das.rdb.config.wrapper.TableWrapper;
+import org.apache.tuscany.das.rdb.impl.InsertCommandImpl;
+import org.apache.tuscany.das.rdb.impl.ParameterImpl;
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+
+public class InsertGenerator extends BaseGenerator {
+
+ public static final InsertGenerator instance = new InsertGenerator();
+
+ private static final boolean debug = false;
+
+ private InsertGenerator() {
+ super();
+ }
+
+ public InsertCommandImpl getInsertCommand(MappingWrapper config,
+ DataObject changedObject, Table t) {
+ ArrayList parameters = new ArrayList();
+ TableWrapper table = new TableWrapper(t);
+ StringBuffer statement = new StringBuffer("insert into ");
+ statement.append(t.getTableName());
+
+ Iterator i = getAttributeProperties(changedObject, config).iterator();
+
+ ArrayList attributes = new ArrayList();
+ while (i.hasNext()) {
+ Property attr = (Property) i.next();
+ if (!table.isGeneratedColumnProperty(attr.getName())) {
+ attributes.add(attr.getName());
+ parameters.add(changedObject.getType().getProperty(
+ attr.getName()));
+ }
+ }
+
+ statement.append("(");
+ Iterator attrs = attributes.iterator();
+ while (attrs.hasNext()) {
+ String name = (String) attrs.next();
+ statement.append("");
+ statement.append(name);
+ if (attrs.hasNext())
+ statement.append(", ");
+ else
+ statement.append(")");
+ }
+
+ statement.append(" values (");
+ for (int idx = 1; idx <= attributes.size(); idx++) {
+ statement.append('?');
+ if (idx < attributes.size())
+ statement.append(", ");
+ else
+ statement.append(")");
+ }
+
+ InsertCommandImpl cmd = new InsertCommandImpl(statement.toString());
+ Iterator params = parameters.iterator();
+ for (int idx = 1; params.hasNext(); idx++) {
+ Property property = (Property) params.next();
+ ParameterImpl p = new ParameterImpl();
+ p.setName(property.getName());
+ p.setType(property.getType());
+ p.setConverter(getConverter(table.getConverter(property.getName())));
+ p.setIndex(idx);
+ cmd.addParameter(p);
+
+ }
+ DebugUtil.debugln(getClass(), debug, statement.toString());
+ return cmd;
+
+ }
+
+ private List getAttributeProperties(DataObject obj, MappingWrapper config) {
+ ArrayList fields = new ArrayList();
+ Iterator i = obj.getType().getProperties().iterator();
+ while (i.hasNext()) {
+ Property p = (Property) i.next();
+ if (p.getType().isDataType()) {
+ if (obj.isSet(p))
+ fields.add(p);
+ } else {
+ if ( obj.isSet(p) ) {
+ Relationship relationship = config.getRelationshipByReference(p);
+ if ( p.getOpposite().isMany() || (hasState(config, relationship, obj))) {
+ RelationshipWrapper r = new RelationshipWrapper(
+ relationship);
+ Iterator keys = r.getForeignKeys().iterator();
+ while (keys.hasNext()) {
+ String key = (String) keys.next();
+ Property keyProp = obj.getType().getProperty(key);
+ fields.add(keyProp);
+ }
+ }
+
+ }
+ }
+ }
+
+ return fields;
+
+ }
+
+ private boolean hasState(MappingWrapper config, Relationship rel, DataObject changedObject) {
+
+ if ( !rel.isMany()) {
+ Table t = config.getTableByTypeName(changedObject.getType().getName());
+ TableWrapper tw = new TableWrapper(t);
+ RelationshipWrapper rw = new RelationshipWrapper(rel);
+ if (( rel.getForeignKeyTable().equals(t.getTableName())) &&
+ ( Collections.disjoint(tw.getPrimaryKeyProperties(),rw.getForeignKeys()) ))
+ return true;
+ }
+
+ return false;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/UpdateGenerator.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/UpdateGenerator.java
new file mode 100644
index 0000000000..3aeb47c4a7
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/UpdateGenerator.java
@@ -0,0 +1,192 @@
+/**
+*
+* Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.tuscany.das.rdb.generator.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.tuscany.das.rdb.config.Column;
+import org.apache.tuscany.das.rdb.config.Table;
+import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper;
+import org.apache.tuscany.das.rdb.config.wrapper.RelationshipWrapper;
+import org.apache.tuscany.das.rdb.config.wrapper.TableWrapper;
+import org.apache.tuscany.das.rdb.impl.ManagedParameterImpl;
+import org.apache.tuscany.das.rdb.impl.OptimisticWriteCommandImpl;
+import org.apache.tuscany.das.rdb.impl.ParameterImpl;
+import org.apache.tuscany.das.rdb.impl.UpdateCommandImpl;
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+import commonj.sdo.ChangeSummary;
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Type;
+
+public class UpdateGenerator extends BaseGenerator {
+
+ private boolean debug = false;
+
+ public static UpdateGenerator instance = new UpdateGenerator();
+
+ private UpdateGenerator() {
+ super();
+ }
+
+ public UpdateCommandImpl getUpdateCommand(MappingWrapper mapping, DataObject changedObject, Table table) {
+ ArrayList updatedProperties = new ArrayList();
+ ArrayList managedProperties = new ArrayList();
+ ArrayList whereClauseProperties = new ArrayList();
+ Type type = changedObject.getType();
+ TableWrapper t = new TableWrapper(table);
+ StringBuffer statement = new StringBuffer("update ");
+ statement.append(table.getTableName());
+ statement.append(" set ");
+
+
+ ChangeSummary summary = changedObject.getDataGraph().getChangeSummary();
+ Iterator i = getChangedFields(mapping, summary, changedObject).iterator();
+
+ while (i.hasNext()) {
+ Property property = (Property) i.next();
+ Column c = t.getColumnByPropertyName(property.getName());
+ if ((c != null) && (c.isCollision() || c.isPrimaryKey())) {
+ // get rid of comma if OCC or PK is last field
+ if (!i.hasNext()) {
+ statement
+ .delete(statement.length() - 2, statement.length());
+ }
+ } else {
+ updatedProperties.add(property);
+ statement.append(c == null ? property.getName() : c.getColumnName());
+ statement.append(" = ?");
+ if (i.hasNext())
+ statement.append(", ");
+ }
+ }
+
+ if ( t.getManagedColumnPropertyName() != null ) {
+ statement.append(", ");
+ statement.append(t.getManagedColumnPropertyName());
+ statement.append(" = ?");
+ managedProperties.add(changedObject.getProperty(t.getManagedColumnPropertyName()));
+ }
+ statement.append(" where ");
+
+ Iterator names = t.getPrimaryKeyNames().iterator();
+ Iterator pkProperties = t.getPrimaryKeyProperties().iterator();
+ while (names.hasNext() && pkProperties.hasNext()) {
+ String name = (String) names.next();
+ String property = (String) pkProperties.next();
+ statement.append(name);
+ statement.append(" = ?");
+ if (names.hasNext() && pkProperties.hasNext())
+ statement.append(" and ");
+ whereClauseProperties.add(type.getProperty(property));
+ }
+
+ if (t.getCollisionColumn() != null) {
+ statement.append(" and ");
+ statement.append(t.getCollisionColumn().getColumnName());
+ statement.append(" = ?");
+ whereClauseProperties.add(type.getProperty(t.getCollisionColumnPropertyName()));
+ }
+
+
+ UpdateCommandImpl updateCommand;
+ if ( t.getCollisionColumn() != null )
+ updateCommand = new OptimisticWriteCommandImpl(statement.toString());
+ else
+ updateCommand = new UpdateCommandImpl(statement.toString());
+
+
+ int idx = 1;
+ Iterator params = updatedProperties.iterator();
+ while ( params.hasNext()) {
+ Property p = (Property)params.next();
+ updateCommand.addParameter(createParameter(t, p, idx++));
+ }
+
+ params = managedProperties.iterator();
+ while ( params.hasNext()) {
+ Property p = (Property)params.next();
+ updateCommand.addParameter(createManagedParameter(t, p, idx++));
+ }
+
+ params = whereClauseProperties.iterator();
+ while ( params.hasNext()) {
+ Property p = (Property)params.next();
+ updateCommand.addParameter(createParameter(t, p, idx++));
+ }
+
+ DebugUtil.debugln(getClass(), debug, statement.toString());
+ return updateCommand;
+ }
+
+
+
+ private List getChangedFields(MappingWrapper mapping, ChangeSummary summary, DataObject obj) {
+ ArrayList changes = new ArrayList();
+ Iterator i = summary.getOldValues(obj).iterator();
+ while (i.hasNext()) {
+ ChangeSummary.Setting setting = (ChangeSummary.Setting) i.next();
+ if (setting.getProperty().getType().isDataType()) {
+ changes.add(setting.getProperty());
+ } else {
+ Property ref = setting.getProperty();
+ if ( !ref.isMany() ) {
+ RelationshipWrapper r = new RelationshipWrapper(mapping.getRelationshipByReference(ref));
+
+ Iterator keys = r.getForeignKeys().iterator();
+ while ( keys.hasNext()) {
+ String key = (String) keys.next();
+ Property p = obj.getType().getProperty(key);
+ changes.add(p);
+ }
+ }
+
+ }
+ }
+ return changes;
+ }
+
+
+
+ private ParameterImpl createManagedParameter(TableWrapper table, Property property, int idx) {
+ ParameterImpl param = new ManagedParameterImpl();
+ param.setName(property.getName());
+ param.setType(property.getType());
+ param.setConverter(getConverter(table.getConverter(property.getName())));
+ if ( idx != -1)
+ param.setIndex(idx);
+
+ return param;
+ }
+
+ private ParameterImpl createParameter(TableWrapper table, Property property, int idx) {
+ ParameterImpl param = new ParameterImpl();
+ param.setName(property.getName());
+ param.setType(property.getType());
+ param.setConverter(getConverter(table.getConverter(property.getName())));
+ if ( idx != -1)
+ param.setIndex(idx);
+
+ return param;
+ }
+
+
+}
+
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java
new file mode 100644
index 0000000000..9279aea2c7
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java
@@ -0,0 +1,116 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.graphbuilder.impl;
+
+import java.util.Iterator;
+
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Type;
+import commonj.sdo.helper.DataFactory;
+
+public class DataObjectMaker {
+
+ private final DataObject rootObject;
+
+ private boolean debug = false;
+
+ public DataObjectMaker(DataObject root) {
+ this.rootObject = root;
+ }
+
+ /**
+ * @param tableData
+ * @return
+ */
+ public DataObject createAndAddDataObject(TableData tableData,
+ ResultMetadata resultMetadata) {
+ // Get a Type from the package and create a standalone DataObject
+
+ DebugUtil.debugln(getClass(), this.debug, "Looking for Type for "
+ + tableData.getTableName());
+
+ Type tableClass = findTableTypeByPropertyName(tableData.getTableName());
+
+ if (tableClass == null)
+ throw new RuntimeException("An SDO Type with name "
+ + tableData.getTableName() + " was not found");
+
+ DataObject obj = DataFactory.INSTANCE.create(tableClass);
+
+ // Now, check to see if the root data object has a containment reference
+ // to this EClass. If so, add it to the graph. If not, it will be taken
+ // care
+ // of when we process relationships
+
+ Iterator i = this.rootObject.getType().getProperties().iterator();
+ while (i.hasNext()) {
+ Property p = (Property) i.next();
+
+ if (p.isContainment() && p.getType().equals(tableClass)) {
+ if (p.isMany())
+ rootObject.getList(p).add(obj);
+ // TODO This was a performance optimization for EMF in SDO 1.1,
+ // check to see if there is
+ // something equivalent in SDO 2.0
+ // ((InternalEList) this.dataGraph.eGet(ref)).addUnique(obj);
+ else
+ this.rootObject.set(p, obj);
+ }
+
+ }
+
+ Iterator columnNames = resultMetadata.getColumnNames(
+ tableData.getTableName()).iterator();
+ while (columnNames.hasNext()) {
+ String columnName = (String) columnNames.next();
+
+ Property p = findProperty(obj.getType(), columnName);
+ Object value = tableData.getColumnData(columnName);
+
+ obj.set(p, value);
+ }
+
+ return obj;
+ }
+
+ // temporary, ignoring case
+ private Property findProperty(Type type, String columnName) {
+ Iterator properties = type.getProperties().iterator();
+ while (properties.hasNext()) {
+ Property p = (Property) properties.next();
+ if (columnName.equalsIgnoreCase(p.getName()))
+ return p;
+ }
+ return null;
+ }
+
+ private Type findTableTypeByPropertyName(String tableName) {
+ Iterator i = rootObject.getType().getProperties().iterator();
+ while (i.hasNext()) {
+ Property p = (Property) i.next();
+ if (tableName.equals(p.getType().getName()))
+ return p.getType();
+ }
+
+ return null;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DefaultConverter.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DefaultConverter.java
new file mode 100644
index 0000000000..54c536d95c
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DefaultConverter.java
@@ -0,0 +1,91 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.graphbuilder.impl;
+
+import java.sql.Blob;
+import java.sql.SQLException;
+
+import org.apache.tuscany.das.rdb.Converter;
+
+
+public class DefaultConverter implements Converter {
+
+ public DefaultConverter() {
+ super();
+ }
+
+ public Object getColumnValue(Object data) {
+ return data;
+ }
+
+ public Object getPropertyValue(Object data) {
+// if (type.isInstance(data))
+// return data;
+//
+// if ( data == null )
+// return null;
+//
+// String name = type.getInstanceClass().getName();
+// if (name == "java.lang.Byte" || name == "byte") {
+// return new Byte(data.toString());
+// }
+//
+// else if (name == "java.lang.Double" || name == "double") {
+// return new Double(data.toString());
+// }
+//
+// else if (name == "java.lang.Float" || name == "float") {
+// return new Float(data.toString());
+// }
+//
+// else if (name == "java.lang.Integer" || name == "int") {
+// return new Integer(data.toString());
+// }
+//
+// else if (name == "java.lang.Long" || name == "long") {
+// return new Long(data.toString());
+// }
+//
+// else if (name == "java.lang.Short" || name == "short") {
+// return new Short(data.toString());
+// }
+//
+// else if (name == "java.lang.String") {
+// return String.valueOf(data.toString());
+// }
+
+ if ( data instanceof Blob ) {
+ Blob b = (Blob) data;
+ try {
+ return b.getBytes(1, (int)b.length());
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ }
+ } else {
+ return data;
+ }
+
+
+
+// else {
+//
+// throw new IllegalArgumentException("The database value of type "
+// + data.getClass().getName() + " must be converted to type "
+// + type.getInstanceClass().getName());
+// }
+ }
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/GraphBuilderMetadata.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/GraphBuilderMetadata.java
new file mode 100644
index 0000000000..0a3bba0c57
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/GraphBuilderMetadata.java
@@ -0,0 +1,100 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.graphbuilder.impl;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+
+import org.apache.tuscany.das.rdb.config.Config;
+import org.apache.tuscany.das.rdb.graphbuilder.schema.ESchemaMaker;
+import org.apache.tuscany.das.rdb.impl.ResultSetShape;
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+import commonj.sdo.Type;
+
+
+/**
+ */
+public class GraphBuilderMetadata {
+
+ private Config mappingModel;
+ private final Collection resultSets = new ArrayList();
+ private boolean debug = false;
+ private String typeURI;
+
+
+ public GraphBuilderMetadata(Collection results, Config model, ResultSetShape shape) throws SQLException {
+ this.mappingModel = model;
+ if (model != null) {
+ this.typeURI = model.getDataObjectModel();
+ }
+
+ Iterator i = results.iterator();
+ while (i.hasNext()) {
+ ResultSet rs = (ResultSet) i.next();
+ ResultMetadata resultMetadata = new ResultMetadata(rs, mappingModel, shape);
+ resultSets.add(resultMetadata);
+ }
+
+ DebugUtil.debugln(getClass(), debug, "Mapping model: " + mappingModel);
+ }
+
+
+ public Collection getResultMetadata() {
+ return this.resultSets;
+ }
+
+
+ public boolean hasMappingModel() {
+ return mappingModel == null ? false : true;
+ }
+
+
+ /**
+ * @return
+ */
+
+ public Collection getRelationships() {
+ if (!hasMappingModel()) {
+ DebugUtil.debugln(getClass(), debug, "No relationships to return");
+ return Collections.EMPTY_LIST;
+ }
+
+ return mappingModel.getRelationship();
+ }
+
+
+ /**
+ * @return
+ */
+ public Type getSchema() {
+ ESchemaMaker schemaMaker = new ESchemaMaker(this);
+ if ( this.typeURI == null ) {
+ return schemaMaker.createTypes();
+ } else {
+ return schemaMaker.createTypes(this.typeURI);
+ }
+ }
+
+ public Config getMapping() {
+ return this.mappingModel;
+ }
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/MultiTableRegistry.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/MultiTableRegistry.java
new file mode 100644
index 0000000000..142aee5c60
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/MultiTableRegistry.java
@@ -0,0 +1,105 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.graphbuilder.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+import commonj.sdo.DataObject;
+
+
+
+/**
+ *
+ * Used to store and look up table objects based on primary key
+ * This could be a lot more efficient if we could use LinkedHashMap from JDK 1.4
+ */
+public class MultiTableRegistry implements TableRegistry {
+
+ private HashMap tableNameMap;
+ private HashMap tableValueMap;
+ private boolean debug = false;
+
+
+ public MultiTableRegistry() {
+ tableNameMap = new HashMap();
+ tableValueMap = new HashMap();
+ }
+
+
+
+ /**
+ * Get the table with the specified name and primary key
+ * @param tableName
+ * @param primaryKey
+ * @return EDataObject
+ */
+ public DataObject get(String tableName, List primaryKey) {
+ if ( debug ) {
+ DebugUtil.debugln(getClass(), debug, "Looking for table " + tableName + " with PK " + primaryKey);
+ DebugUtil.debugln(getClass(), debug, ("\tReturning " + getPkMap(tableName).get(primaryKey)));
+ }
+ return (DataObject) getPkMap(tableName).get(primaryKey);
+ }
+
+ /**
+ * Add the table with the specified name and primary key
+ * @param tableName
+ * @param primaryKey
+ * @param value
+ */
+ public void put(String tableName, List primaryKey, DataObject value) {
+ if ( getPkMap(tableName).put(primaryKey, value) == null )
+ getCreateValueList(tableName).add(value);
+ }
+
+ /**
+ * Get the HashMap that contains the primary key to table object
+ * mappings.
+ * @param tableName
+ * @return HashMap
+ */
+ private HashMap getPkMap(String tableName) {
+ HashMap pkMap = (HashMap)tableNameMap.get(tableName);
+ if ( pkMap == null ) {
+ pkMap = new HashMap();
+ tableNameMap.put(tableName, pkMap);
+ }
+ return pkMap;
+ }
+
+ private List getCreateValueList(String tableName) {
+ List values = (List) tableValueMap.get(tableName);
+ if ( values == null ) {
+ values = new ArrayList();
+ tableValueMap.put(tableName, values);
+ }
+ return values;
+ }
+
+
+
+ public boolean contains(String tableName, List primaryKey) {
+ return get(tableName,primaryKey) == null ? false : true;
+
+ }
+
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java
new file mode 100644
index 0000000000..a455ed348a
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java
@@ -0,0 +1,286 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.graphbuilder.impl;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.apache.tuscany.das.rdb.Converter;
+import org.apache.tuscany.das.rdb.config.Column;
+import org.apache.tuscany.das.rdb.config.Config;
+import org.apache.tuscany.das.rdb.config.Table;
+import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper;
+import org.apache.tuscany.das.rdb.config.wrapper.TableWrapper;
+import org.apache.tuscany.das.rdb.impl.ResultSetShape;
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+import commonj.sdo.Type;
+
+public class ResultMetadata {
+
+ private HashMap tableToColumnMap = new HashMap();
+
+ private ArrayList typeNames = new ArrayList();
+
+ private ArrayList propertyNames = new ArrayList();
+
+ private final ResultSet resultSet;
+
+ private final ResultSetShape resultSetShape;
+
+ private final MappingWrapper mappingWrapper;
+
+ private Converter[] converters;
+
+ private static boolean debug = false;
+
+ public ResultMetadata(ResultSet rs, Config model, ResultSetShape shape)
+ throws SQLException {
+ debug("Creating new ResultMetadata with mapping model " + model);
+ this.resultSet = rs;
+ this.mappingWrapper = new MappingWrapper(model);
+
+ if (shape == null)
+ this.resultSetShape = new ResultSetShape(rs.getMetaData());
+ else
+ this.resultSetShape = shape;
+
+ this.converters = new Converter[resultSetShape.getColumnCount()];
+
+ for (int i = 1; i <= resultSetShape.getColumnCount(); i++) {
+ String tableName = resultSetShape.getTableName(i);
+
+ String typeName = mappingWrapper
+ .getTableTypeName(tableName);
+ String propertyName = mappingWrapper.getColumnPropertyName(
+ tableName, resultSetShape.getColumnName(i));
+ String converterName = mappingWrapper.getConverter(tableName,
+ resultSetShape.getColumnName(i));
+
+ converters[i-1] = loadConverter(converterName);
+
+ DebugUtil.debugln(getClass(), debug, "Adding table/column: "
+ + typeName + "/" + propertyName);
+ typeNames.add(typeName);
+ propertyNames.add(propertyName);
+
+ Collection columns = (Collection) tableToColumnMap
+ .get(typeName);
+ if (columns == null)
+ columns = new ArrayList();
+ columns.add(propertyName);
+ tableToColumnMap.put(typeName, columns);
+ }
+
+ // Add any tables defined in the model but not included in the ResultSet
+ // to the list of propertyNames
+ if (model != null) {
+ Iterator tablesFromModel = model.getTable().iterator();
+ while (tablesFromModel.hasNext()) {
+ TableWrapper t = new TableWrapper((Table) tablesFromModel
+ .next());
+ if (tableToColumnMap.get(t.getTypeName()) == null)
+ tableToColumnMap.put(t.getTypeName(),
+ Collections.EMPTY_LIST);
+ }
+ }
+
+ if (debug) {
+ DebugUtil.debugln(getClass(), debug, toString());
+ DebugUtil
+ .debugln(getClass(), debug, this.resultSetShape.toString());
+ }
+
+ }
+
+ private Converter loadConverter(String converterName) {
+ if (converterName != null) {
+
+ try {
+
+ Class converterClazz= Class.forName(converterName, true, Thread.currentThread().getContextClassLoader());
+ if(null != converterClazz)
+ return (Converter) converterClazz.newInstance();
+ } catch( Exception ex){
+ throw new RuntimeException(ex);
+ }
+
+ try{
+ Class converterClazz = Class.forName(converterName);
+ if ( converterClazz != null)
+ return (Converter)converterClazz.newInstance();
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+ return new DefaultConverter();
+ }
+
+ private void debug(Object string) {
+ if (debug)
+ DebugUtil.debugln(getClass(), debug, string);
+ }
+
+ public String getColumnPropertyName(int i) {
+ return (String) propertyNames.get(i - 1);
+ }
+
+ public String getDatabaseColumnName(int i) {
+ return resultSetShape.getColumnName(i);
+ }
+
+ public String getTableName(String columnName) {
+ return (String) typeNames.get(propertyNames
+ .indexOf(columnName));
+ }
+
+ public int getTableSize(String tableName) {
+ return ((Collection) tableToColumnMap.get(tableName)).size();
+ }
+
+ public Type getDataType(String columnName) {
+ return resultSetShape.getColumnType(propertyNames
+ .indexOf(columnName));
+ }
+
+ public String getTablePropertyName(int i) {
+ return (String) typeNames.get(i - 1);
+ }
+
+ public Collection getAllTablePropertyNames() {
+ return tableToColumnMap.keySet();
+ }
+
+ public String toString() {
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (Table Names: ");
+ Iterator i = typeNames.iterator();
+ while (i.hasNext()) {
+ String tableName = (String) i.next();
+ result.append(' ');
+ result.append(tableName);
+ result.append(',');
+ }
+
+ result.append(" columnNames: ");
+
+ i = propertyNames.iterator();
+ while (i.hasNext()) {
+ String columnName = (String) i.next();
+ result.append(' ');
+ result.append(columnName);
+ result.append(',');
+ }
+
+ result.append(" mappingModel: ");
+ result.append(this.mappingWrapper.getConfig());
+
+ result.append(" resultSet: ");
+ result.append(resultSet);
+
+ result.append(" resultSetSize: ");
+ result.append(resultSetShape.getColumnCount());
+ result.append(')');
+ return result.toString();
+
+ }
+
+ /**
+ * @return
+ */
+ public int getNumberOfTables() {
+ return tableToColumnMap.keySet().size();
+ }
+
+ /**
+ * Return whether the column at the given position is part of a primary key.
+ * If we don't have this information, we assume every column is a primary
+ * key. This results in uniqueness checks using all columns in a table.
+ *
+ * @param i
+ * @return
+ */
+ public boolean isPKColumn(int i) {
+ if (debug) {
+ DebugUtil.debugln(getClass(), debug, "Checking to see if "
+ + getColumnPropertyName(i) + " is a PK column in "
+ + getTablePropertyName(i));
+ }
+ if (!hasMappingModel()) {
+ if (debug)
+ DebugUtil
+ .debugln(getClass(), debug,
+ "No mapping model exists, all columns will be considered PK columns");
+ return true;
+ } else {
+ Table t = mappingWrapper.getTableByTypeName(getTablePropertyName(i));
+ if (t == null)
+ return true;
+ Column c = mappingWrapper.getColumn(t, getDatabaseColumnName(i));
+
+ if (c == null)
+ return false;
+
+ if (c.isPrimaryKey())
+ return true;
+ }
+ return false;
+ }
+
+ public boolean hasMappingModel() {
+ return mappingWrapper.getConfig() == null ? false : true;
+ }
+
+ /**
+ * @param i
+ * @return
+ */
+ public Type getDataType(int i) {
+ return resultSetShape.getColumnType(i);
+ }
+
+ /**
+ * @param tableName
+ * @return
+ */
+ public Collection getColumnNames(String tableName) {
+ return (Collection) tableToColumnMap.get(tableName);
+ }
+
+ public ResultSet getResultSet() {
+ return this.resultSet;
+ }
+
+ public int getResultSetSize() {
+ return resultSetShape.getColumnCount();
+ }
+
+ public boolean isRecursive() {
+ return mappingWrapper.hasRecursiveRelationships();
+ }
+
+ public Converter getConverter(int i) {
+ return converters[i - 1];
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetProcessor.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetProcessor.java
new file mode 100644
index 0000000000..6d68162dee
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetProcessor.java
@@ -0,0 +1,137 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.graphbuilder.impl;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Iterator;
+
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+import commonj.sdo.DataObject;
+
+/**
+ *
+ * A ResultSetProcessor is used to transform the data in a ResultSet into a set
+ * of inter-related EDataObjects.
+ */
+public class ResultSetProcessor {
+
+ private TableRegistry registry;
+
+ private GraphBuilderMetadata metadata;
+
+ private boolean debug = false;
+
+ private final DataObjectMaker doMaker;
+
+ public ResultSetProcessor(DataObject g, GraphBuilderMetadata gbmd) {
+
+ this.metadata = gbmd;
+ if (metadata.getRelationships().size() == 0)
+ registry = new SingleTableRegistry();
+ else
+ registry = new MultiTableRegistry();
+
+ doMaker = new DataObjectMaker(g);
+
+ debug(metadata);
+
+ }
+
+ private void debug(Object output) {
+ DebugUtil.debugln(getClass(), debug, output);
+ }
+
+ /**
+ * Process the ResultSet. For each row in the ResultSet, a
+ *
+ * @link ResultSetRow object will be created to represent the row as a set
+ * of EDataObjects. Then, the relevant relationships will be
+ * constructed between each object in the
+ * @link ResultSetRow.
+ *
+ * @param rs
+ * The ResultSet
+ */
+ public void processResults(int start, int end) throws SQLException {
+
+ Iterator i = metadata.getResultMetadata().iterator();
+ while ( i.hasNext()) {
+ ResultMetadata resultMetadata = (ResultMetadata)i.next();
+ ResultSet results = resultMetadata.getResultSet();
+
+ processResultSet(results, resultMetadata, start, end);
+
+ //TODO These statements HAVE to be closed or we will have major problems
+// results.getStatement().close();
+ results.close();
+ }
+
+ }
+
+
+ private void processResultSet(ResultSet rs, ResultMetadata rsMetadata,
+ int start, int end) throws SQLException {
+
+ if ( rs.getType() == ResultSet.TYPE_FORWARD_ONLY) {
+ while (rs.next() && start < end) {
+ ResultSetRow rsr = new ResultSetRow(rs, rsMetadata);
+ addRowToGraph(rsr, rsMetadata);
+ ++start;
+ }
+ } else {
+ while (rs.absolute(start) && start < end) {
+ ResultSetRow rsr = new ResultSetRow(rs, rsMetadata);
+ addRowToGraph(rsr, rsMetadata);
+ ++start;
+ }
+ }
+ }
+
+ /**
+ * @param row
+ * @param resultMetadata
+ */
+ private void addRowToGraph(ResultSetRow row, ResultMetadata resultMetadata) {
+ RowObjects tableObjects = new RowObjects(metadata, registry);
+ Iterator tables = row.getAllTableData().iterator();
+ while (tables.hasNext()) {
+ TableData rawDataFromRow = (TableData) tables.next();
+
+ if ( (resultMetadata.hasMappingModel()) && (!rawDataFromRow.hasValidPrimaryKey() ) )
+ continue;
+
+ String tableName = rawDataFromRow.getTableName();
+ DataObject tableObject = registry.get(tableName, rawDataFromRow
+ .getPrimaryKeyValues());
+ if (tableObject == null) {
+ tableObject = doMaker.createAndAddDataObject(rawDataFromRow, resultMetadata);
+
+ debug("Putting table " + tableName + " with PK " + rawDataFromRow.getPrimaryKeyValues() + " into registry");
+
+ registry.put(tableName, rawDataFromRow.getPrimaryKeyValues(),
+ tableObject);
+ }
+ tableObjects.put(tableName, tableObject);
+ }
+
+ tableObjects.processRelationships();
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetRow.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetRow.java
new file mode 100644
index 0000000000..f68f48fc06
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetRow.java
@@ -0,0 +1,169 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.graphbuilder.impl;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+
+/**
+ *
+ * A ResultSetRow is used to transform a single row of a ResultSet into a set of
+ * EDataObjects.
+ */
+public class ResultSetRow {
+
+ private final ResultMetadata metadata;
+
+ private HashMap tableMap = new HashMap();
+
+ private ArrayList allTableData;
+
+ private boolean debug = false;
+
+ /**
+ * Method ResultSetRow.
+ *
+ * @param rs
+ * A ResultSet positioned on the desired row
+ * @param ePackage
+ * The package used to create EDataObjects
+ */
+ public ResultSetRow(ResultSet rs, ResultMetadata m) throws SQLException {
+ this.metadata = m;
+ if (m.isRecursive())
+ processRecursiveRow(rs);
+ else
+ processRow(rs);
+ }
+
+ /**
+ * Processes a single row in the ResultSet Method processRow.
+ *
+ * @param rs
+ */
+ private void processRow(ResultSet rs) throws SQLException {
+
+ DebugUtil.debugln(getClass(), debug, "");
+ for (int i = 1; i <= metadata.getResultSetSize(); i++) {
+ Object data = getObject(rs, i);
+
+ TableData table = getRawData(metadata.getTablePropertyName(i));
+ DebugUtil.debugln(getClass(), debug, "Adding column: "
+ + metadata.getColumnPropertyName(i) + "\tValue: " + data
+ + "\tTable: " + metadata.getTablePropertyName(i));
+ table.addData(metadata.getColumnPropertyName(i), metadata
+ .isPKColumn(i), data);
+ }
+
+ }
+
+ public void processRecursiveRow(ResultSet rs) throws SQLException {
+ this.allTableData = new ArrayList();
+ int i = 1;
+ DebugUtil.debugln(getClass(), debug, "");
+ while (i <= metadata.getResultSetSize()) {
+ DebugUtil.debugln(getClass(), debug, "");
+ TableData table = new TableData(metadata.getTablePropertyName(i));
+ this.allTableData.add(table);
+
+ while ( (i <= metadata.getResultSetSize()) && (metadata.isPKColumn(i))) {
+ Object data = getObject(rs, i);
+ DebugUtil.debugln(getClass(), debug, "Adding column: "
+ + metadata.getColumnPropertyName(i) + "\tValue: " + data
+ + "\tTable: " + metadata.getTablePropertyName(i));
+ table.addData(metadata.getColumnPropertyName(i), true, data);
+ i++;
+ }
+
+ while ( (i <= metadata.getResultSetSize()) &&
+ (!metadata.isPKColumn(i))) {
+ Object data = getObject(rs, i);
+ DebugUtil.debugln(getClass(), debug, "Adding column: "
+ + metadata.getColumnPropertyName(i) + "\tValue: " + data
+ + "\tTable: " + metadata.getTablePropertyName(i));
+ table.addData(metadata.getColumnPropertyName(i), false, data);
+ i++;
+ }
+ }
+ }
+
+ /**
+ * @param rs
+ * @param metadata
+ * @param i
+ * @return
+ */
+ private Object getObject(ResultSet rs, int i)
+ throws SQLException {
+
+ Object data = rs.getObject(i);
+
+ if (rs.wasNull())
+ return null;
+ else
+ return metadata.getConverter(i).getPropertyValue(data);
+ }
+
+ /**
+ * Returns a HashMap that holds data for the specified table
+ *
+ * @param tableName
+ * The name of the table
+ * @return HashMap
+ */
+ public TableData getTable(String tableName) {
+ return (TableData) tableMap.get(tableName);
+ }
+
+ /**
+ * Returns a HashMap that holds data for the specified table If the HashMap
+ * doesn't exist, it will be created. This is used internally to build the
+ * ResultSetRow, whereas getTable is used externally to retrieve existing
+ * table data.
+ *
+ * @param tableName
+ * The name of the table
+ * @return HashMap
+ */
+ private TableData getRawData(String tableName) {
+
+ TableData table = (TableData) tableMap.get(tableName);
+
+ if (table == null) {
+ table = new TableData(tableName);
+ tableMap.put(tableName, table);
+ }
+
+ return table;
+ }
+
+ public ArrayList getAllTableData() {
+ if ( this.allTableData == null ) {
+ this.allTableData = new ArrayList();
+ this.allTableData.addAll(tableMap.values());
+ }
+ DebugUtil.debugln(getClass(), debug, allTableData);
+
+ return this.allTableData;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/RowObjects.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/RowObjects.java
new file mode 100644
index 0000000000..5c366a1898
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/RowObjects.java
@@ -0,0 +1,140 @@
+/**
+*
+* Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.tuscany.das.rdb.graphbuilder.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.apache.tuscany.das.rdb.config.KeyPair;
+import org.apache.tuscany.das.rdb.config.Relationship;
+import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper;
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+
+
+public class RowObjects {
+
+ private HashMap objectsByTableName;
+
+ private ArrayList tableObjects;
+
+ private static final boolean debug = false;
+
+ private final GraphBuilderMetadata metadata;
+
+ private final TableRegistry registry;
+
+ public RowObjects(GraphBuilderMetadata metadata, TableRegistry registry) {
+ objectsByTableName = new HashMap();
+ tableObjects = new ArrayList();
+ this.metadata = metadata;
+ this.registry = registry;
+ }
+
+ public void put(String key, DataObject value) {
+ objectsByTableName.put(key, value);
+ tableObjects.add(value);
+ }
+
+ public DataObject get(String tablePropertyName) {
+ return (DataObject) objectsByTableName.get(tablePropertyName);
+ }
+
+ void processRelationships() {
+ MappingWrapper wrapper = new MappingWrapper(metadata.getMapping());
+ if (wrapper.hasRecursiveRelationships()) {
+ processRecursiveRelationships(wrapper);
+ return;
+ }
+
+ Iterator i = metadata.getRelationships().iterator();
+ while (i.hasNext()) {
+ Relationship r = (Relationship) i.next();
+
+
+ DataObject parentTable = get(wrapper
+ .getTableTypeName(r.getPrimaryKeyTable()));
+ DataObject childTable = get(wrapper
+ .getTableTypeName(r.getForeignKeyTable()));
+
+ DebugUtil.debugln(getClass(), debug, "Parent table: " + parentTable);
+ DebugUtil.debugln(getClass(), debug, "Child table: " + childTable);
+
+ if ((parentTable == null) || (childTable == null))
+ continue;
+
+ Property p = parentTable.getType().getProperty(r.getName());
+ setOrAdd(parentTable, childTable, p);
+
+ }
+ }
+
+
+
+ private void processRecursiveRelationships(MappingWrapper wrapper) {
+ Iterator i = tableObjects.iterator();
+ while (i.hasNext()) {
+ DataObject table = (DataObject) i.next();
+
+ Iterator relationships = wrapper.getRelationshipsByChildTable(table.getType().getName()).iterator();
+ while ( relationships.hasNext() ) {
+ Relationship r = (Relationship) relationships.next();
+
+ DataObject parentTable = findParentTable(table, r, wrapper);
+
+ if (parentTable == null)
+ continue;
+
+ Property p = parentTable.getType().getProperty(r.getName());
+ setOrAdd(parentTable, table, p);
+ }
+
+ }
+ }
+
+ private void setOrAdd(DataObject parent, DataObject child, Property p) {
+ if (p.isMany()) {
+ parent.getList(p).add(child);
+ } else {
+ parent.set(p, child);
+ }
+ }
+
+ private DataObject findParentTable(DataObject childTable,
+ Relationship r, MappingWrapper wrapper) {
+
+ ArrayList fkValue = new ArrayList();
+ Iterator keyPairs = r.getKeyPair().iterator();
+ while (keyPairs.hasNext()) {
+ KeyPair pair = (KeyPair) keyPairs.next();
+ String childProperty = wrapper.getColumnPropertyName(r.getPrimaryKeyTable(), pair.getForeignKeyColumn());
+
+ Property p = childTable.getType().getProperty(childProperty);
+ fkValue.add(childTable.get(p));
+ }
+
+ DebugUtil.debugln(getClass(), debug, "Trying to find parent of " + r.getForeignKeyTable() + " with FK "
+ + fkValue);
+ DataObject parentTable = registry.get(r.getPrimaryKeyTable(), fkValue);
+ DebugUtil.debugln(getClass(), debug, "Parent table from registry: " + parentTable);
+ return parentTable;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/SingleTableRegistry.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/SingleTableRegistry.java
new file mode 100644
index 0000000000..f00ef2770d
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/SingleTableRegistry.java
@@ -0,0 +1,52 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.graphbuilder.impl;
+
+import java.util.List;
+
+import commonj.sdo.DataObject;
+
+/**
+ */
+public class SingleTableRegistry implements TableRegistry {
+
+ //private HashMap<List,DataObject> values = new HashMap<List,DataObject>();
+
+ public SingleTableRegistry() {
+ // Empty Constructor
+ }
+
+ /* (non-Javadoc)
+ * @see com.ibm.ws.sdo.mediator.jdbc.graphbuilder.impl.TableRegistry#get(java.lang.String, java.util.List)
+ */
+ public DataObject get(String tableName, List primaryKey) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see com.ibm.ws.sdo.mediator.jdbc.graphbuilder.impl.TableRegistry#put(java.lang.String, java.util.List, java.lang.Object)
+ */
+ public void put(String tableName, List primaryKey, DataObject value) {
+ // do nothing
+
+ }
+
+ public boolean contains(String name, List list) {
+ return false;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java
new file mode 100644
index 0000000000..48b6dc0187
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java
@@ -0,0 +1,75 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.graphbuilder.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+
+/**
+ *
+ */
+public class TableData {
+
+ private HashMap columnData = new HashMap();
+ private ArrayList primaryKey = new ArrayList();
+ private final String name;
+ private boolean hasValidPrimaryKey = true;
+ private static final boolean debug = false;
+
+ public TableData(String tableName) {
+ DebugUtil.debugln(getClass(), debug, "Creating TableData for table " + tableName);
+ this.name = tableName;
+ }
+
+
+ public void addData(String columnName, boolean isPrimaryKeyColumn, Object data) {
+ DebugUtil.debugln(getClass(), debug, "Adding column " + columnName + " with value " + data);
+ columnData.put(columnName, data);
+ if ( isPrimaryKeyColumn ) {
+ if ( data == null ) {
+ DebugUtil.debugln(getClass(), debug, "Column " + columnName + " is a primary key column and is null");
+ hasValidPrimaryKey = false;
+ }
+ primaryKey.add(data);
+ }
+ }
+
+ public Object getColumnData(String columnName) {
+ return columnData.get(columnName);
+ }
+
+ public String getTableName() {
+ return this.name;
+ }
+
+
+ /**
+ * @return
+ */
+ public List getPrimaryKeyValues() {
+ return primaryKey;
+ }
+
+
+ public boolean hasValidPrimaryKey() {
+ return hasValidPrimaryKey;
+ }
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableRegistry.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableRegistry.java
new file mode 100644
index 0000000000..4b5a3677ae
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableRegistry.java
@@ -0,0 +1,43 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.graphbuilder.impl;
+
+import java.util.List;
+
+import commonj.sdo.DataObject;
+
+/**
+ */
+public interface TableRegistry {
+ /**
+ * Get the table with the specified name and primary key
+ * @param tableName
+ * @param primaryKey
+ * @return EDataObject
+ */
+ public DataObject get(String tableName, List primaryKey);
+
+ /**
+ * Add the table with the specified name and primary key
+ * @param tableName
+ * @param primaryKey
+ * @param value
+ */
+ public void put(String tableName, List primaryKey, DataObject value);
+
+ public boolean contains(String name, List list);
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ESchemaMaker.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ESchemaMaker.java
new file mode 100644
index 0000000000..170b597134
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ESchemaMaker.java
@@ -0,0 +1,203 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.graphbuilder.schema;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.apache.tuscany.das.rdb.config.Relationship;
+import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper;
+import org.apache.tuscany.das.rdb.graphbuilder.impl.GraphBuilderMetadata;
+import org.apache.tuscany.das.rdb.graphbuilder.impl.ResultMetadata;
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+import org.apache.tuscany.sdo.helper.TypeHelperImpl;
+import org.apache.tuscany.sdo.util.DataObjectUtil;
+import org.apache.tuscany.sdo.util.SDOUtil;
+import org.eclipse.emf.ecore.EPackage;
+
+import commonj.sdo.Property;
+import commonj.sdo.Type;
+import commonj.sdo.helper.TypeHelper;
+
+/**
+ *
+ * An ESchemaMaker is used to create an EMF Schema from an instance of JDBC
+ * Mediator Metadata.
+ *
+ */
+public class ESchemaMaker {
+
+ private final GraphBuilderMetadata metadata;
+
+ private boolean debug = false;
+
+ private TypeHelper typeHelper = SDOUtil.createTypeHelper();
+
+ /**
+ * Constructor for ESchemaMaker. Creates an SDO model based on the metadata
+ * passed in.
+ *
+ * @param metadata
+ */
+ public ESchemaMaker(GraphBuilderMetadata metadata) {
+ this.metadata = metadata;
+ }
+
+ /**
+ * Creates an EMF Schema by using the
+ *
+ * @link TableMaker and
+ * @link RelationshipMaker to transform
+ * @link Metadata elements into EMF Schema elements.
+ */
+
+ public Type createTypes() {
+
+ DataObjectUtil.initRuntime();
+ SDOUtil.createDataGraph();
+
+
+ Type rootType = SDOUtil.createType(typeHelper, getURI(), "DataGraphRoot", false);
+
+ Iterator iter = metadata.getResultMetadata().iterator();
+ while (iter.hasNext()) {
+
+ ResultMetadata resultMetadata = (ResultMetadata) iter.next();
+
+ // Create a Type for each Table represented in the ResultSet
+ Iterator names = resultMetadata.getAllTablePropertyNames()
+ .iterator();
+ while (names.hasNext()) {
+ String tableName = (String) names.next();
+
+ Type tableType = SDOUtil.createType(typeHelper, getURI(), tableName, false);
+ Property property = SDOUtil.createProperty(rootType, tableName, tableType);
+ SDOUtil.setMany(property,true);
+ SDOUtil.setContainment(property, true);
+ }
+
+ // TODO tablePropertyMap is temporary until Tuscany-203 is fixed
+ HashMap tablePropertyMap = new HashMap();
+
+ for (int i = 1; i <= resultMetadata.getResultSetSize(); i++) {
+
+ Property ref = rootType.getProperty(resultMetadata.getTablePropertyName(i));
+
+ // TODO Temporary code to check to see if a property has already been added.
+ // Replace when Tuscany-203 is fixed
+ ArrayList addedProperties = (ArrayList) tablePropertyMap.get(ref.getName());
+ if ( addedProperties == null ) {
+ addedProperties = new ArrayList();
+ tablePropertyMap.put(ref.getName(), addedProperties);
+ }
+
+ if (ref == null)
+ throw new RuntimeException("Could not find table "
+ + resultMetadata.getTablePropertyName(i)
+ + " in the SDO model");
+
+ String columnName = resultMetadata.getColumnPropertyName(i);
+
+ // TODO temporary check until Tuscany-203 is fixed
+ if ( !addedProperties.contains(columnName)) {
+ addedProperties.add(columnName);
+ Type atype = resultMetadata.getDataType(i);
+
+ SDOUtil.createProperty(ref.getType(), columnName, atype);
+
+ DebugUtil.debugln(getClass(), debug, "Adding column "
+ + columnName + " to "
+ + resultMetadata.getTablePropertyName(i));
+ }
+
+ }
+ }
+
+ if (metadata.hasMappingModel()) {
+ MappingWrapper wrapper = new MappingWrapper(metadata.getMapping());
+ Iterator i = metadata.getRelationships().iterator();
+ while (i.hasNext()) {
+ Relationship r = (Relationship) i.next();
+
+ String parentName = wrapper.getTableTypeName(r.getPrimaryKeyTable());
+ String childName = wrapper.getTableTypeName(r.getForeignKeyTable());
+
+ if (parentName == null) {
+ throw new RuntimeException("The parent table ("
+ + r.getPrimaryKeyTable() + ") in relationship "
+ + r.getName()
+ + " was not found in the mapping information.");
+ } else if (childName == null) {
+ throw new RuntimeException("The child table ("
+ + r.getForeignKeyTable() + ") in relationship "
+ + r.getName()
+ + " was not found in the mapping information.");
+ }
+
+ Property parentProperty = rootType.getProperty(parentName);
+ Property childProperty = rootType.getProperty(childName);
+
+ if (parentProperty == null) {
+ throw new RuntimeException("The parent table ("
+ + parentName + ") in relationship "
+ + r.getName()
+ + " was not found.");
+ } else if (childProperty == null) {
+ throw new RuntimeException("The child table ("
+ + childName + ") in relationship "
+ + r.getName()
+ + " was not found.");
+ }
+
+ Type parent = parentProperty.getType();
+ Type child = childProperty.getType();
+
+ Property parentProp = SDOUtil.createProperty(parent, r.getName(), child);
+ Property childProp = SDOUtil.createProperty(child, r.getName() + "_opposite", parent);
+ SDOUtil.setOpposite(parentProp, childProp);
+ SDOUtil.setOpposite(childProp, parentProp);
+ SDOUtil.setMany(parentProp, r.isMany());
+ }
+
+ }
+
+ return rootType;
+ }
+
+ private String getURI() {
+ return "http:///org.apache.tuscany.das.rdb/das";
+ }
+
+ public Type createTypes(String uri) {
+ Type rootType = SDOUtil.createType(typeHelper, getURI() + "/DataGraphRoot", "DataGraphRoot", false);
+
+ EPackage pkg = ((TypeHelperImpl)typeHelper).getExtendedMetaData().getPackage(uri);
+ if ( pkg == null )
+ throw new RuntimeException("SDO Types have not been registered for URI " + uri);
+ Iterator i = pkg.getEClassifiers().iterator();
+ while ( i.hasNext() ) {
+ Type type = (Type) i.next();
+ Property property = SDOUtil.createProperty(rootType, type.getName(), type);
+ SDOUtil.setContainment(property, true);
+ SDOUtil.setMany(property, true);
+ }
+ return rootType;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ResultSetTypeMap.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ResultSetTypeMap.java
new file mode 100644
index 0000000000..832cfeac7e
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ResultSetTypeMap.java
@@ -0,0 +1,133 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.graphbuilder.schema;
+
+import java.sql.Types;
+
+import org.apache.tuscany.sdo.SDOPackage;
+
+import commonj.sdo.Type;
+import commonj.sdo.helper.TypeHelper;
+
+/**
+ */
+public class ResultSetTypeMap {
+
+ public static ResultSetTypeMap instance = new ResultSetTypeMap();
+
+ /**
+ * Constructor for ResultSetTypeMap.
+ */
+ protected ResultSetTypeMap() {
+ // Empty Constructor
+ }
+
+ /**
+ * These mappings taken primarily from "JDBC API and Tutorial and Reference" by
+ * Fisher, Ellis and Bruce.
+ *
+ * @param type
+ * @param isNullable
+ * @return
+ */
+ public Type getEDataType(int type, boolean isNullable) {
+
+ TypeHelper helper = TypeHelper.INSTANCE;
+ SDOPackage.eINSTANCE.eClass();
+ switch (type) {
+
+ case Types.CHAR:
+ case Types.VARCHAR:
+ case Types.LONGVARCHAR:
+ return helper.getType("commonj.sdo", "String");
+
+ case Types.NUMERIC:
+ case Types.DECIMAL:
+ return helper.getType("commonj.sdo", "Decimal");
+
+ case Types.BIT:
+ case Types.BOOLEAN:
+ if (isNullable)
+ return helper.getType("commonj.sdo", "Boolean");
+ else
+ return helper.getType("commonj.sdo", "boolean");
+
+ case Types.TINYINT:
+ case Types.SMALLINT:
+ case Types.INTEGER:
+ if (isNullable) {
+ return helper.getType("commonj.sdo", "IntObject");
+ } else
+ return helper.getType("commonj.sdo", "Int");
+
+ case Types.BIGINT:
+ if (isNullable)
+ return helper.getType("commonj.sdo", "Long");
+ else
+ return helper.getType("commonj.sdo", "long");
+
+ case Types.REAL:
+ if (isNullable)
+ return helper.getType("commonj.sdo", "Float");
+ else
+ return helper.getType("commonj.sdo", "float");
+
+ case Types.FLOAT:
+ case Types.DOUBLE:
+ if (isNullable)
+ return helper.getType("commonj.sdo", "Double");
+ else
+ return helper.getType("commonj.sdo", "double");
+
+ case Types.BINARY:
+ case Types.VARBINARY:
+ case Types.LONGVARBINARY:
+ return helper.getType("commonj.sdo", "ByteArray");
+
+ case Types.DATE:
+ case Types.TIME:
+ case Types.TIMESTAMP:
+ return helper.getType("commonj.sdo", "Date");
+
+ case Types.CLOB:
+ return helper.getType("commonj.sdo", "Clob");
+
+ case Types.BLOB:
+ return helper.getType("commonj.sdo", "Blob");
+
+ case Types.ARRAY:
+ return helper.getType("commonj.sdo", "Array");
+
+ case Types.DISTINCT:
+ case Types.STRUCT:
+ case Types.REF:
+ case Types.DATALINK:
+ case Types.JAVA_OBJECT:
+ return helper.getType("commonj.sdo", "Object");
+
+ default:
+ return helper.getType("commonj.sdo", "Object");
+ }
+
+ }
+
+
+ public Type getType(int columnType, boolean b) {
+ return getEDataType(columnType, b);
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ApplyChangesCommandImpl.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ApplyChangesCommandImpl.java
new file mode 100644
index 0000000000..610adf3ff6
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ApplyChangesCommandImpl.java
@@ -0,0 +1,93 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import java.sql.Connection;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.config.Config;
+import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper;
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Type;
+
+/**
+ *
+ */
+public class ApplyChangesCommandImpl extends BaseCommandImpl {
+
+ private static final boolean debug = false;
+
+ private ChangeSummarizer summarizer = new ChangeSummarizer();
+
+ public ApplyChangesCommandImpl() {
+ }
+
+ public ApplyChangesCommandImpl(Config config){
+ this.configWrapper = new MappingWrapper(config);
+ }
+
+ public ApplyChangesCommandImpl(Config config, Connection connection){
+ this.configWrapper = new MappingWrapper(config);
+ if ( connection != null )
+ setConnection(connection, config);
+
+ }
+
+ public void setConnection(ConnectionImpl connection) {
+ summarizer.setConnection(connection);
+ }
+
+ public void addCreateCommand(Type type, Command cmd) {
+ summarizer.addCreateCommand(type, cmd);
+ }
+
+ public void addUpdateCommand(Type type, Command cmd) {
+ summarizer.addUpdateCommand(type, cmd);
+ }
+
+ public void addDeleteCommand(Type type, Command cmd) {
+ summarizer.addDeleteCommand(type, cmd);
+ }
+
+ public void execute(DataObject root) {
+ DebugUtil.debugln(getClass(), debug, "Executing ApplyChangesCmd");
+
+ if (summarizer.getConnection() == null)
+ throw new RuntimeException("A connection must be provided");
+
+ if (!root.equals(root.getDataGraph().getRootObject()))
+ throw new RuntimeException("'root' argument must be the root of the datagraph");
+
+ summarizer.setMapping(configWrapper);
+
+ Changes changes = summarizer.loadChanges(root);
+
+ boolean success = false;
+ try {
+ changes.execute();
+ success = true;
+ } finally {
+ if (success)
+ summarizer.getConnection().cleanUp();
+ else
+ summarizer.getConnection().errorCleanUp();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/BaseCommandImpl.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/BaseCommandImpl.java
new file mode 100644
index 0000000000..1b9ac360e5
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/BaseCommandImpl.java
@@ -0,0 +1,48 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import java.sql.Connection;
+
+import org.apache.tuscany.das.rdb.config.Config;
+import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper;
+
+public abstract class BaseCommandImpl {
+
+ protected MappingWrapper configWrapper = new MappingWrapper();
+
+ public void setConnection(Connection connection) {
+ setConnection(new ConnectionImpl(connection));
+ }
+
+ public void setConnection(Connection connection, Config config) {
+ boolean managed = true;
+ if ( config != null && config.getConnectionInfo() != null )
+ managed = config.getConnectionInfo().isManagedtx();
+ setConnection(connection, managed);
+ }
+
+ public void setConnection(Connection connection, boolean manageTransaction) {
+ ConnectionImpl c = new ConnectionImpl(connection);
+ c.setManageTransactions(manageTransaction);
+ setConnection(c);
+ }
+
+ public abstract void setConnection(ConnectionImpl c);
+
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeFactory.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeFactory.java
new file mode 100644
index 0000000000..24fca8fe10
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeFactory.java
@@ -0,0 +1,183 @@
+/**
+*
+* Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.tuscany.das.rdb.impl;
+
+import org.apache.tuscany.das.rdb.config.Create;
+import org.apache.tuscany.das.rdb.config.Delete;
+import org.apache.tuscany.das.rdb.config.Table;
+import org.apache.tuscany.das.rdb.config.Update;
+import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper;
+import org.apache.tuscany.das.rdb.config.wrapper.TableWrapper;
+import org.apache.tuscany.das.rdb.generator.impl.DeleteGenerator;
+import org.apache.tuscany.das.rdb.generator.impl.InsertGenerator;
+import org.apache.tuscany.das.rdb.generator.impl.UpdateGenerator;
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Type;
+
+public class ChangeFactory {
+
+ private final Type type;
+
+ private InsertCommandImpl createCommand;
+
+ private UpdateCommandImpl updateCommand;
+
+ private DeleteCommandImpl deleteCommand;
+
+ private static final boolean debug = false;
+
+ private final MappingWrapper mapping;
+
+ private final ConnectionImpl connection;
+
+ public ChangeFactory(Type type, MappingWrapper mapping, ConnectionImpl connection) {
+ this.type = type;
+ this.mapping = mapping;
+ this.connection = connection;
+ }
+
+ public Type getType() {
+ return this.type;
+ }
+
+ public void setCreateCommand(InsertCommandImpl cmd) {
+ createCommand = cmd;
+ }
+
+ public void setUpdateCommand(UpdateCommandImpl cmd) {
+ DebugUtil.debugln(getClass(), debug, "Setting Update Command to " + cmd);
+ updateCommand = cmd;
+ }
+
+ public void setDeleteCommand(DeleteCommandImpl cmd) {
+ deleteCommand = cmd;
+ }
+
+ ChangeOperation createUpdateOperation(DataObject changedObject, String propagatedID) {
+ return new UpdateOperation(getUpdateCommand(changedObject), changedObject, propagatedID);
+ }
+ ChangeOperation createUpdateOperation(DataObject changedObject) {
+ return createUpdateOperation(changedObject, null);
+ }
+
+ ChangeOperation createDeleteOperation(DataObject changedObject) {
+ return new DeleteOperation(getDeleteCommand(changedObject), changedObject);
+ }
+
+ ChangeOperation createInsertOperation(DataObject changedObject, String propagatedID) {
+ return new CreateOperation(getCreateCommand(changedObject), changedObject, propagatedID);
+ }
+
+ ChangeOperation createInsertOperation(DataObject changedObject) {
+ return createInsertOperation(changedObject, null);
+ }
+
+
+ private InsertCommandImpl getCreateCommand(DataObject changedObject) {
+
+ if ( createCommand == null ) {
+ Table table = mapping.getTableByTypeName(changedObject.getType().getName());
+ if (table == null ) {
+ if (changedObject.getType().getProperty("ID") != null ) {
+ // If the table is not defined in the config, assume it has a primary key of "ID"
+ mapping.addPrimaryKey(changedObject.getType().getName() + ".ID");
+ table = mapping.getTableByTypeName(changedObject.getType().getName());
+ } else {
+ throw new RuntimeException("Table " + changedObject.getType().getName() + " was changed in the DataGraph but is not present in the Config");
+ }
+ }
+
+ Create create = table.getCreate();
+
+ if ( create == null ) {
+ createCommand = InsertGenerator.instance.getInsertCommand(mapping, changedObject, table);
+ } else {
+ createCommand = new InsertCommandImpl(create);
+ }
+ createCommand.setConnection(connection);
+ createCommand.configWrapper = mapping;
+ }
+ return createCommand;
+ }
+
+ private DeleteCommandImpl getDeleteCommand(DataObject changedObject) {
+
+ if ( deleteCommand == null ) {
+ Table table = mapping.getTableByTypeName(changedObject.getType().getName());
+ if (table == null ) {
+ if (changedObject.getType().getProperty("ID") != null ) {
+ // If the table is not defined in the config, assume it has a primary key of "ID"
+ mapping.addPrimaryKey(changedObject.getType().getName() + ".ID");
+ table = mapping.getTableByTypeName(changedObject.getType().getName());
+ } else {
+ throw new RuntimeException("Table " + changedObject.getType().getName() + " was changed in the DataGraph but is not present in the Config");
+ }
+ }
+
+ Delete delete = table.getDelete();
+
+ if ( delete == null ) {
+ deleteCommand = DeleteGenerator.instance.getDeleteCommand(table);
+ } else {
+ deleteCommand = new DeleteCommandImpl(delete);
+ }
+ deleteCommand.setConnection(connection);
+ }
+ return deleteCommand;
+ }
+
+ private UpdateCommandImpl getUpdateCommand(DataObject changedObject) {
+
+ if ( updateCommand == null ) {
+ Table table = mapping.getTableByTypeName(changedObject.getType().getName());
+ if (table == null ) {
+ if (changedObject.getType().getProperty("ID") != null ) {
+ // If the table is not defined in the config, assume it has a primary key of "ID"
+ mapping.addPrimaryKey(changedObject.getType().getName() + ".ID");
+ table = mapping.getTableByTypeName(changedObject.getType().getName());
+ } else {
+ throw new RuntimeException("Table " + changedObject.getType().getName() + " was changed in the DataGraph but is not present in the Config");
+ }
+ }
+
+ Update update = table.getUpdate();
+
+ if ( update == null ) {
+ updateCommand = UpdateGenerator.instance.getUpdateCommand(mapping, changedObject,table);
+ } else {
+ TableWrapper t = new TableWrapper(table);
+ if ( t.getCollisionColumn() != null )
+ updateCommand = new OptimisticWriteCommandImpl(update);
+ else
+ updateCommand = new UpdateCommandImpl(update);
+
+ }
+ updateCommand.setConnection(connection);
+ updateCommand.configWrapper = mapping;
+ }
+ DebugUtil.debugln(getClass(), debug, "Returning updateCommand: " + updateCommand);
+ return updateCommand;
+ }
+
+ public MappingWrapper getConfig() {
+ return this.mapping;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeOperation.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeOperation.java
new file mode 100644
index 0000000000..5db52bf2be
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeOperation.java
@@ -0,0 +1,78 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import java.util.Iterator;
+
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+import commonj.sdo.DataObject;
+
+/**
+ */
+public abstract class ChangeOperation {
+
+ private final WriteCommandImpl writeCommand;
+
+ protected DatabaseObject dObject;
+
+ private static final boolean debug = false;
+
+ protected String propagatedID = null;
+
+ private boolean isInsert = false;
+
+ public ChangeOperation(DeleteCommandImpl command) {
+ writeCommand = command;
+ }
+
+ public ChangeOperation(InsertCommandImpl command, DataObject changedObject) {
+ writeCommand = command;
+ dObject = new DatabaseObject(command.getMappingModel(), changedObject);
+ this.isInsert = true;
+ }
+
+ public ChangeOperation(UpdateCommandImpl command, DataObject changedObject) {
+ writeCommand = command;
+ dObject = new DatabaseObject(command.getMappingModel(), changedObject);
+ }
+
+ public void execute() {
+ DebugUtil.debugln(getClass(), debug, "Executing change operation");
+
+ Iterator i = writeCommand.getParameters().iterator();
+ while (i.hasNext()) {
+ ParameterImpl parm = (ParameterImpl) i.next();
+ DebugUtil.debugln(getClass(), debug, "setting " + parm.getName() + " to " + dObject.get(parm.getName()));
+ parm.setValue(dObject.get(parm.getName()));
+ }
+
+ writeCommand.execute();
+
+ if ( isInsert && ( propagatedID != null )) {
+ DebugUtil.debugln(getClass(), debug, "Propagating key " + propagatedID);
+ int id = writeCommand.getGeneratedKey();
+ dObject.setPropagatedID(propagatedID, id);
+ }
+ }
+
+ public String getTableName() {
+ return dObject.getTableName();
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeSummarizer.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeSummarizer.java
new file mode 100644
index 0000000000..78addfb72c
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeSummarizer.java
@@ -0,0 +1,239 @@
+/**
+*
+* Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.tuscany.das.rdb.impl;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.config.Column;
+import org.apache.tuscany.das.rdb.config.Relationship;
+import org.apache.tuscany.das.rdb.config.Table;
+import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper;
+import org.apache.tuscany.das.rdb.config.wrapper.RelationshipWrapper;
+import org.apache.tuscany.das.rdb.config.wrapper.TableWrapper;
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+import org.apache.tuscany.sdo.impl.ChangeSummaryImpl;
+
+import commonj.sdo.ChangeSummary;
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Type;
+
+public class ChangeSummarizer {
+
+ private static final boolean debug = false;
+
+ private Changes changes = new Changes();
+
+ private FactoryRegistry registry;
+
+ private MappingWrapper mapping = new MappingWrapper();
+
+ private ConnectionImpl connection;
+
+ private HashMap generatedKeys = new HashMap();
+
+ public ChangeSummarizer() {
+ // Empty Constructor
+ }
+
+ public Changes loadChanges(DataObject root) {
+ ChangeSummary changeSummary = root.getDataGraph().getChangeSummary();
+ if (changeSummary.isLogging())
+ ((ChangeSummaryImpl) changeSummary).summarize();
+
+ List changedObjects = changeSummary.getChangedDataObjects();
+ DebugUtil.debugln(getClass(), debug,
+ "List of changed objects contains " + changedObjects.size()
+ + " object(s)");
+
+ changes.setInsertOrder(mapping.getInsertOrder());
+ changes.setDeleteOrder(mapping.getDeleteOrder());
+
+ Iterator i = changedObjects.iterator();
+ while (i.hasNext()) {
+ DataObject o = (DataObject) i.next();
+
+ if (!(o.equals(root))) {
+ createChange(changeSummary, o);
+ }
+ }
+
+ return changes;
+ }
+
+ public void createChange(ChangeSummary changeSummary,
+ DataObject changedObject) {
+
+ if (changeSummary.isCreated(changedObject)) {
+ DebugUtil.debugln(getClass(), debug, "Change is a create");
+ if (!changeSummary.isDeleted(changedObject)) {
+ ChangeFactory factory = getRegistry().getFactory(
+ changedObject.getType());
+ String propagatedID = (String) generatedKeys.get(changedObject
+ .getType().getName());
+ changes.addInsert(factory.createInsertOperation(changedObject,
+ propagatedID));
+ }
+ } else if (changeSummary.isDeleted(changedObject)) {
+ ChangeFactory factory = getRegistry().getFactory(
+ changedObject.getType());
+ DebugUtil.debugln(getClass(), debug, "Change is a delete");
+ changes.addDelete(factory.createDeleteOperation(changedObject));
+ } else {
+ // bumpCollisionField(changedObject);
+ DebugUtil.debugln(getClass(), debug, "Change is a modify");
+ List attrList = changeSummary.getOldValues(changedObject);
+ if (hasAttributeChange(attrList)) {
+ ChangeFactory factory = getRegistry().getFactory(
+ changedObject.getType());
+ DebugUtil.debugln(getClass(), debug, "Attribute Change for "
+ + changedObject.getType().getName());
+ String propagatedID = (String) generatedKeys.get(changedObject
+ .getType().getName());
+ changes.addUpdate(factory.createUpdateOperation(changedObject,
+ propagatedID));
+ } else {
+ // Reference change
+ List values = changeSummary.getOldValues(changedObject);
+ Iterator i = values.iterator();
+ while (i.hasNext()) {
+ ChangeSummary.Setting setting = (ChangeSummary.Setting) i
+ .next();
+
+ if (!setting.getProperty().getType().isDataType()) {
+ DebugUtil.debugln(getClass(), debug,
+ "Reference change for "
+ + changedObject.getType().getName());
+
+ Property ref = setting.getProperty();
+
+ DebugUtil.debugln(getClass(), debug, ref.getName());
+ if (hasState(ref, changedObject) ) {
+ ChangeFactory factory = getRegistry().getFactory(
+ changedObject.getType());
+ changes.addUpdate(factory
+ .createUpdateOperation(changedObject));
+ }
+
+ }
+ }
+ }
+ }
+
+ }
+
+ private boolean hasState(Property ref, DataObject changedObject) {
+ if ( ref.getOpposite().isMany() ) {
+ return true;
+ } else {
+ MappingWrapper mw = this.mapping;
+ if ( mw.getConfig() == null )
+ mw = registry.getFactory(changedObject.getType()).getConfig();
+ if ( mw.getConfig() == null )
+ return false;
+
+ Relationship rel = mw.getRelationshipByReference(ref);
+
+ if ( !rel.isMany()) {
+ // This is a one-one relationship
+ Table t = mapping.getTableByTypeName(changedObject.getType().getName());
+ TableWrapper tw = new TableWrapper(t);
+ RelationshipWrapper rw = new RelationshipWrapper(rel);
+ if (( rel.getForeignKeyTable().equals(t.getTableName())) &&
+ ( Collections.disjoint(tw.getPrimaryKeyProperties(),rw.getForeignKeys()) ))
+ return true;
+
+ }
+
+ }
+ return false;
+ }
+
+ private boolean hasAttributeChange(List theChanges) {
+ Iterator i = theChanges.iterator();
+ while (i.hasNext()) {
+ ChangeSummary.Setting setting = (ChangeSummary.Setting) i.next();
+ if (setting.getProperty().getType().isDataType())
+ return true;
+ }
+ return false;
+ }
+
+ public void addCreateCommand(Type type, Command cmd) {
+ ChangeFactory cf = getRegistry().getFactory(type);
+ cf.setCreateCommand((InsertCommandImpl) cmd);
+ ((CommandImpl) cmd).setConnection(connection);
+ }
+
+ public void addUpdateCommand(Type type, Command cmd) {
+ ChangeFactory cf = getRegistry().getFactory(type);
+ cf.setUpdateCommand((UpdateCommandImpl) cmd);
+ ((CommandImpl) cmd).setConnection(connection);
+ }
+
+ public void addDeleteCommand(Type type, Command cmd) {
+ ChangeFactory cf = getRegistry().getFactory(type);
+ cf.setDeleteCommand((DeleteCommandImpl) cmd);
+ ((CommandImpl) cmd).setConnection(connection);
+
+ }
+
+ private FactoryRegistry getRegistry() {
+ if (this.registry == null) {
+ this.registry = new FactoryRegistry(mapping, connection);
+ }
+ return this.registry;
+ }
+
+ public void setConnection(ConnectionImpl connection) {
+ this.connection = connection;
+ }
+
+ public void setMapping(MappingWrapper map) {
+ this.mapping = map;
+
+ if ( mapping.getConfig() == null )
+ return;
+
+ Iterator i = mapping.getConfig().getTable().iterator();
+ while (i.hasNext()) {
+ Table t = (Table) i.next();
+ Iterator columns = t.getColumn().iterator();
+ while ( columns.hasNext()) {
+ Column c = (Column) columns.next();
+ if ( c.isPrimaryKey() && c.isGenerated()) {
+ DebugUtil.debugln(getClass(), debug, "adding generated key "
+ + t.getTableName() + "."
+ + c.getColumnName());
+ generatedKeys.put(t.getTableName(), c.getColumnName());
+ }
+ }
+ }
+ }
+
+
+ public ConnectionImpl getConnection() {
+ return this.connection;
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Changes.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Changes.java
new file mode 100644
index 0000000000..77198fe589
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Changes.java
@@ -0,0 +1,80 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * Mangages a set of graph-change operations. This simple implementaiton can be
+ * replaced with a version that provides R/I sorting
+ *
+ */
+public class Changes {
+
+ private InsertList inserts = new InsertList();
+ private UpdateList updates = new UpdateList();
+ private DeleteList deletes = new DeleteList();
+
+
+ public void addInsert(ChangeOperation c) {
+ inserts.add(c);
+ }
+
+ public void addUpdate(ChangeOperation c) {
+ updates.add(c);
+ }
+
+ public void addDelete(ChangeOperation c) {
+ deletes.add(c);
+ }
+
+ /**
+ * Execute all my change
+ */
+ public void execute() {
+
+ Iterator i = inserts.getSortedList().iterator();
+ while ( i.hasNext() ) {
+ ChangeOperation c = (ChangeOperation) i.next();
+ c.execute();
+ }
+
+ i = updates.getSortedList().iterator();
+ while ( i.hasNext() ) {
+ ChangeOperation c = (ChangeOperation) i.next();
+ c.execute();
+ }
+
+
+ i = deletes.getSortedList().iterator();
+ while (i.hasNext() ) {
+ ChangeOperation c = (ChangeOperation) i.next();
+ c.execute();
+ }
+
+ }
+
+ public void setInsertOrder(ArrayList insertOrder) {
+ inserts.setOrder(insertOrder);
+ }
+
+ public void setDeleteOrder(ArrayList deleteOrder) {
+ deletes.setOrder(deleteOrder);
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandImpl.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandImpl.java
new file mode 100644
index 0000000000..0a2cc7a5f1
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandImpl.java
@@ -0,0 +1,100 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+
+import org.apache.tuscany.das.rdb.Command;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.XSDHelper;
+
+public abstract class CommandImpl extends BaseCommandImpl implements Command {
+
+ protected Statement statement;
+
+ protected Parameters parameters = new Parameters();
+
+ protected static final boolean debug = false;
+
+ protected ResultSetShape resultSetShape;
+
+ public CommandImpl(String sqlString) {
+ statement = new Statement(sqlString);
+
+ try {
+ URL url = getClass().getResource("/xml/sdoJava.xsd");
+ if (url == null)
+ throw new RuntimeException(
+ "Could not find resource: xml/sdoJava.xsd");
+
+ InputStream inputStream = url.openStream();
+ XSDHelper.INSTANCE.define(inputStream, url.toString());
+ inputStream.close();
+ } catch ( IOException ex ) {
+ throw new RuntimeException(ex);
+ }
+
+ }
+
+ public abstract void execute();
+
+ public abstract DataObject executeQuery();
+
+ public void setParameter(int index, Object value) {
+ parameters.setParameter(index, value);
+ }
+
+ public void addParameter(ParameterImpl param) {
+ parameters.add(param);
+ }
+
+
+ public List getParameters() {
+ return parameters.parameterList();
+ }
+
+ public Object getParameter(int index) {
+ return parameters.parameterWithIndex(index).getValue();
+ }
+
+ public void setConnection(ConnectionImpl connection) {
+ statement.setConnection(connection);
+ }
+
+ protected ConnectionImpl getConnection() {
+ return statement.getConnection();
+ }
+
+
+ /*
+ * The default impl is to throw an exception. This is overridden by
+ * InsertCommandImpl
+ */
+ public int getGeneratedKey() {
+
+ throw new RuntimeException("This method is only valid for insert commands");
+ }
+
+ public void close() {
+ statement.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java
new file mode 100644
index 0000000000..d6ef150d6d
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java
@@ -0,0 +1,95 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import java.sql.CallableStatement;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+
+public class ConnectionImpl {
+
+ private Connection connection;
+ private static final boolean debug = false;
+
+ private boolean managingTransaction = true;
+
+ public ConnectionImpl(Connection connection) {
+ this.connection = connection;
+
+ try {
+ if (connection.getAutoCommit())
+ throw new RuntimeException("AutoCommit must be off!");
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ public Connection getJDBCConnection() {
+ return connection;
+ }
+
+ public void cleanUp() {
+ try {
+ if (managingTransaction) {
+ DebugUtil.debugln(getClass(), debug, "Committing Transaction");
+ connection.commit();
+ }
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void errorCleanUp() {
+ try {
+ if (managingTransaction) {
+ DebugUtil.debugln(getClass(), debug, "Rolling back Transaction");
+ connection.rollback();
+ }
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public PreparedStatement prepareStatement(String queryString)
+ throws SQLException {
+ DebugUtil.debugln(getClass(), debug, "Preparing Statement: " + queryString);
+ return connection.prepareStatement(queryString, java.sql.Statement.RETURN_GENERATED_KEYS);
+ }
+
+ public PreparedStatement preparePagedStatement(String queryString) throws SQLException {
+ DebugUtil.debugln(getClass(), debug, "Preparing Statement: " + queryString);
+ return connection.prepareStatement(queryString, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
+ }
+
+ public void setManageTransactions(boolean manageTransactions) {
+ managingTransaction = manageTransactions;
+
+ }
+
+ public CallableStatement prepareCall(String queryString) throws SQLException {
+ return connection.prepareCall(queryString);
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CreateOperation.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CreateOperation.java
new file mode 100644
index 0000000000..5c70dc1e6f
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CreateOperation.java
@@ -0,0 +1,29 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+
+import commonj.sdo.DataObject;
+
+public class CreateOperation extends ChangeOperation {
+
+ public CreateOperation(InsertCommandImpl command, DataObject changedObject, String ID) {
+ super(command, changedObject);
+ this.propagatedID = ID;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASFactoryImpl.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASFactoryImpl.java
new file mode 100644
index 0000000000..dded0aa46e
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASFactoryImpl.java
@@ -0,0 +1,53 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import java.io.InputStream;
+import java.sql.Connection;
+
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.DASFactory;
+import org.apache.tuscany.das.rdb.config.Config;
+
+public class DASFactoryImpl implements DASFactory {
+
+ public DAS createDAS(InputStream configStream) {
+ return new DASImpl(configStream);
+ }
+
+ public DAS createDAS(Config config) {
+ return new DASImpl(config);
+ }
+
+ public DAS createDAS() {
+ return new DASImpl();
+ }
+
+ public DAS createDAS(InputStream configStream, Connection connection) {
+ return new DASImpl(configStream, connection);
+ }
+
+ public DAS createDAS(Config config, Connection connection) {
+ return new DASImpl(config, connection);
+ }
+
+ public DAS createDAS(Connection connection) {
+ return new DASImpl(connection);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASImpl.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASImpl.java
new file mode 100644
index 0000000000..ee38c04faa
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASImpl.java
@@ -0,0 +1,234 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import java.io.InputStream;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.sql.DataSource;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.config.Config;
+import org.apache.tuscany.das.rdb.util.ConfigUtil;
+
+import commonj.sdo.DataObject;
+
+/**
+ * An ConfiguredCommandFactory produces instances of Command and
+ * ApplyChangesCommand. This factory is initialized with a configuration that
+ * defines the commands it produces.
+ *
+ */
+public class DASImpl implements DAS {
+
+ private Config config;
+
+ private Connection connection;
+
+ private Map commands = new HashMap();
+
+ public DASImpl(InputStream stream) {
+ this(ConfigUtil.loadConfig(stream));
+
+ }
+
+ public DASImpl(Config inConfig) {
+ this.config = inConfig;
+
+ Iterator i = config.getCommand().iterator();
+ while (i.hasNext()) {
+ org.apache.tuscany.das.rdb.config.Command commandConfig = (org.apache.tuscany.das.rdb.config.Command) i
+ .next();
+ String kind = commandConfig.getKind();
+ if (kind.equalsIgnoreCase("select"))
+ commands.put(commandConfig.getName(), new ReadCommandImpl(commandConfig.getSQL(), config, commandConfig.getResultDescriptor()));
+ else if (kind.equalsIgnoreCase("update"))
+ commands.put(commandConfig.getName(), new UpdateCommandImpl(commandConfig.getSQL()));
+ else if (kind.equalsIgnoreCase("insert"))
+ commands.put(commandConfig.getName(), new InsertCommandImpl(commandConfig.getSQL()));
+ else if (kind.equalsIgnoreCase("delete"))
+ commands.put(commandConfig.getName(), new DeleteCommandImpl(commandConfig.getSQL()));
+ else if (kind.equalsIgnoreCase("procedure"))
+ commands.put(commandConfig.getName(), new SPCommandImpl(commandConfig.getSQL(),config, commandConfig.getParameter()));
+ else
+ throw new RuntimeException("Invalid kind of command: " + kind);
+
+ }
+
+ }
+
+ public DASImpl() {
+ // Empty Constructor
+ }
+
+ public DASImpl(Config inConfig, Connection inConnection) {
+ this(inConfig);
+ setConnection(inConnection);
+ }
+
+ public DASImpl(InputStream configStream, Connection inConnection) {
+ this(ConfigUtil.loadConfig(configStream), inConnection);
+ }
+
+ public DASImpl(Connection inConnection) {
+ setConnection(inConnection);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.das.rdb.CommandGroup#getApplyChangesCommand()
+ */
+ public ApplyChangesCommandImpl getApplyChangesCommand() {
+ ApplyChangesCommandImpl cmd = new ApplyChangesCommandImpl(config, connection);
+ return cmd;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.das.rdb.CommandGroup#getCommand(java.lang.String)
+ */
+ public Command getCommand(String name) {
+ if (!commands.containsKey(name))
+ throw new RuntimeException("CommandGroup has no command named: " + name);
+ CommandImpl cmd = (CommandImpl) commands.get(name);
+ cmd.setConnection(getConnection(), config);
+ return cmd;
+ }
+
+
+ public void setConnection(Connection connection) {
+ this.connection = connection;
+ }
+
+ public Connection getConnection() {
+ if (connection == null)
+ initializeConnection();
+ return connection;
+ }
+
+ private void initializeConnection() {
+
+ if (config == null ||
+ config.getConnectionInfo() == null ||
+ config.getConnectionInfo().getDataSource() == null)
+ throw new RuntimeException(
+ "No connection has been provided and no data source has been specified");
+
+ Connection connection = null;
+
+ InitialContext ctx;
+ try {
+ ctx = new InitialContext();
+ } catch (NamingException e) {
+ throw new RuntimeException(e);
+ }
+ try {
+ // TODO - I think we should rename this getDataSourceURL?
+ DataSource ds = (DataSource) ctx.lookup(config.getConnectionInfo().getDataSource());
+ try {
+ connection = ds.getConnection();
+ connection.setAutoCommit(false);
+ setConnection(connection);
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ }
+ } catch (NamingException e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ public void releaseResources() {
+
+ if (managingConnections())
+ closeConnection();
+ }
+
+ private void closeConnection() {
+ if (connection != null)
+ try {
+ connection.close();
+ connection = null;
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * If the config has connection properties then we are "managing" the
+ * connection via DataSource
+ */
+ private boolean managingConnections() {
+
+ if (config.getConnectionInfo().getDataSource() == null)
+ return false;
+ else
+ return true;
+
+ }
+
+ public Command createCommand(String sql) {
+ return baseCreateCommand(sql, this.config);
+ }
+
+ public Command createCommand(String sql, Config config) {
+ return baseCreateCommand(sql, config);
+ }
+
+ private Command baseCreateCommand(String sql, Config config) {
+ CommandImpl returnCmd = null;
+ sql = sql.trim(); // Remove leading white space
+ char firstChar = Character.toUpperCase(sql.charAt(0));
+ switch (firstChar) {
+ case 'S':
+ returnCmd = new ReadCommandImpl(sql, config, null);
+ break;
+ case 'I':
+ returnCmd = new InsertCommandImpl(sql);
+ break;
+ case 'U':
+ returnCmd = new UpdateCommandImpl(sql);
+ break;
+ case 'D':
+ returnCmd = new DeleteCommandImpl(sql);
+ break;
+ case '{':
+ returnCmd = new SPCommandImpl(sql, config, Collections.EMPTY_LIST);
+ break;
+ default:
+ throw new RuntimeException("SQL => " + sql + " is not valid");
+ }
+
+ returnCmd.setConnection(getConnection(), config);
+ return returnCmd;
+ }
+
+ public void applyChanges(DataObject root) {
+ getApplyChangesCommand().execute(root);
+ }
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DatabaseObject.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DatabaseObject.java
new file mode 100644
index 0000000000..e49ece3050
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DatabaseObject.java
@@ -0,0 +1,148 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.tuscany.das.rdb.config.Column;
+import org.apache.tuscany.das.rdb.config.Config;
+import org.apache.tuscany.das.rdb.config.KeyPair;
+import org.apache.tuscany.das.rdb.config.Relationship;
+import org.apache.tuscany.das.rdb.config.Table;
+import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper;
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+
+/**
+ * DatabaseObject wraps DataObject. If a field is an FK field, it will return
+ * the value from the parent.
+ *
+ *
+ */
+public class DatabaseObject {
+
+ private final MappingWrapper mappingWrapper;
+
+ private final DataObject dataObject;
+
+ private Property parentReference;
+
+ private static final boolean debug = false;
+
+ private HashMap keyMappings = new HashMap();
+
+ public DatabaseObject(Config model, DataObject changedObject) {
+ this.mappingWrapper = new MappingWrapper(model);
+ this.dataObject = changedObject;
+ initialize();
+ }
+
+ // Initialize Key Mappings
+ private void initialize() {
+ if (mappingWrapper.getConfig() != null) {
+ List relationships = mappingWrapper.getConfig().getRelationship();
+ Iterator i = relationships.iterator();
+ while (i.hasNext()) {
+ Relationship r = (Relationship) i.next();
+ DebugUtil.debugln(getClass(), debug, "Initializing relationship: " + r.getName());
+ if (r.getForeignKeyTable().equals(getTypeName())) {
+ List pairs = r.getKeyPair();
+ Iterator iter = pairs.iterator();
+ while (iter.hasNext()) {
+ KeyPair pair = (KeyPair) iter.next();
+ keyMappings.put(pair.getForeignKeyColumn(), r);
+ }
+ }
+ }
+ }
+ }
+
+ public Object get(String parameter) {
+
+ if (isPartOfPrimaryKey(parameter))
+ return dataObject.get(parameter);
+
+ Relationship r = (Relationship) keyMappings.get(parameter);
+ if (r == null)
+ return dataObject.get(parameter);
+
+ Property parentRef = getParentReference(r.getPrimaryKeyTable());
+ DataObject parent = dataObject.getDataObject(parentRef);
+ if (parent == null)
+ return null;
+ String parentKey = getParentKey(r, parameter);
+ return parent.get(parentKey);
+
+ }
+
+ private String getParentKey(Relationship r, String parameter) {
+ List keyPairs = r.getKeyPair();
+ Iterator i = keyPairs.iterator();
+ while (i.hasNext()) {
+ KeyPair pair = (KeyPair) i.next();
+ if (pair.getForeignKeyColumn().equals(parameter))
+ return pair.getPrimaryKeyColumn();
+ }
+ return null;
+ }
+
+ public Property getParentReference(String parentName) {
+ if (this.parentReference == null) {
+
+ Iterator i = dataObject.getType().getProperties().iterator();
+ while (i.hasNext()) {
+ Property ref = (Property) i.next();
+ if ((!ref.getType().isDataType()) && (ref.getType().getName().equals(parentName))) {
+ this.parentReference = ref;
+ }
+ }
+ }
+ return this.parentReference;
+ }
+
+ public String getTableName() {
+ if (mappingWrapper.getConfig() != null)
+ return mappingWrapper.getTableByTypeName(getTypeName()).getTableName();
+ else
+ return null;
+ }
+
+ public String getTypeName() {
+ return dataObject.getType().getName();
+ }
+
+ public void setPropagatedID(String propagatedID, int id) {
+ dataObject.setInt(propagatedID, id);
+ }
+
+ private boolean isPartOfPrimaryKey(String parameter) {
+ if (mappingWrapper.getConfig() == null)
+ return false;
+ Table t = mappingWrapper.getTable(getTableName());
+ if (t == null)
+ return false;
+ Column c = mappingWrapper.getColumnByPropertyName(t, parameter);
+ if (c == null)
+ return false;
+ return c.isPrimaryKey();
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteCommandImpl.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteCommandImpl.java
new file mode 100644
index 0000000000..8c39dcac87
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteCommandImpl.java
@@ -0,0 +1,32 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import org.apache.tuscany.das.rdb.config.Delete;
+
+public class DeleteCommandImpl extends WriteCommandImpl {
+
+ public DeleteCommandImpl(String sqlString) {
+ super(sqlString);
+ }
+
+ public DeleteCommandImpl(Delete delete) {
+ super(delete.getSql());
+ addParameters(delete.getParameters());
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteList.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteList.java
new file mode 100644
index 0000000000..8650c6119c
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteList.java
@@ -0,0 +1,72 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
+/**
+ * DeleteList will sort delete operations so that child objects are deleted
+ * before their parents
+ *
+ *
+ */
+public class DeleteList {
+
+ private HashMap opsByTableName = new HashMap();
+
+ private ArrayList order;
+
+ private ArrayList deleteOperations = new ArrayList();
+
+ public DeleteList() {
+ super();
+ }
+
+ public void add(ChangeOperation op) {
+ if (( order == null ) || ( op.getTableName() == null ) ) {
+ deleteOperations.add(op);
+ } else {
+ String name = op.getTableName();
+ ArrayList ops = (ArrayList) opsByTableName.get(name);
+ if (ops == null)
+ ops = new ArrayList();
+
+ ops.add(op);
+ opsByTableName.put(name, ops);
+ }
+ }
+
+ public Collection getSortedList() {
+ if (( order != null ) && ( opsByTableName.keySet().size() > 0) ) {
+ Iterator i = this.order.iterator();
+ while (i.hasNext()) {
+ String name = (String) i.next();
+ deleteOperations.addAll((Collection) opsByTableName.get(name));
+ }
+ }
+
+ return deleteOperations;
+ }
+
+ public void setOrder(ArrayList deleteOrder) {
+ this.order = deleteOrder;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteOperation.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteOperation.java
new file mode 100644
index 0000000000..7b71e0ace9
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteOperation.java
@@ -0,0 +1,38 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import org.apache.tuscany.das.rdb.util.DataObjectUtil;
+
+import commonj.sdo.DataObject;
+
+public class DeleteOperation extends ChangeOperation {
+
+
+ /**
+ * @param command
+ * @param changedObject
+ * Objects deleted from the graph have lost their "settings" and must
+ * be restored
+ */
+ public DeleteOperation(DeleteCommandImpl command, DataObject changedObject) {
+ super(command);
+ this.dObject = new DatabaseObject(command.getMappingModel(),DataObjectUtil.getRestoredCopy(changedObject));
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/FactoryRegistry.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/FactoryRegistry.java
new file mode 100644
index 0000000000..ce09c748f4
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/FactoryRegistry.java
@@ -0,0 +1,49 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import java.util.HashMap;
+
+import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper;
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+import commonj.sdo.Type;
+
+public class FactoryRegistry {
+
+ private HashMap registry = new HashMap();
+ private static final boolean debug = false;
+ private final MappingWrapper mapping;
+ private final ConnectionImpl connection;
+
+ public FactoryRegistry(MappingWrapper mapping, ConnectionImpl connection) {
+ this.mapping = mapping;
+ this.connection = connection;
+ }
+
+ public ChangeFactory getFactory(Type type) {
+ ChangeFactory factory = (ChangeFactory)registry.get(type);
+ if ( factory == null ) {
+ DebugUtil.debugln(getClass(), debug, "Creating new ChangeFactory for type " + type.getName());
+ factory = new ChangeFactory(type, mapping, connection);
+ registry.put(type, factory);
+ }
+ return factory;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertCommandImpl.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertCommandImpl.java
new file mode 100644
index 0000000000..59e88c2f6c
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertCommandImpl.java
@@ -0,0 +1,75 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import java.sql.SQLException;
+
+import org.apache.tuscany.das.rdb.config.Create;
+
+public class InsertCommandImpl extends WriteCommandImpl {
+
+ private int generatedKey;
+
+ private boolean hasGeneratedKey = false;
+
+ public InsertCommandImpl(String sqlString) {
+ super(sqlString);
+ }
+
+ public InsertCommandImpl(Create create) {
+ super(create.getSql());
+ addParameters(create.getParameters());
+ }
+
+ protected boolean isInsert() {
+ return true;
+ }
+
+ public int getGeneratedKey() {
+
+ if (hasGeneratedKey)
+ return generatedKey;
+
+ throw new RuntimeException("No generated key is available");
+ }
+
+ protected void subtypeProcessing() throws SQLException {
+ loadGeneratedKey();
+ }
+
+ private void loadGeneratedKey() throws SQLException {
+ Integer key = statement.getGeneratedKey();
+ if (key != null) {
+ hasGeneratedKey = true;
+ generatedKey = key.intValue();
+ }
+
+ }
+
+ public String toString() {
+
+ String superString = super.toString();
+ StringBuffer buffer = new StringBuffer(superString);
+
+ buffer.append("\nGenerating key: " + hasGeneratedKey);
+ if (hasGeneratedKey)
+ buffer.append("\nGenerated key: " + generatedKey);
+
+ return buffer.toString();
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertList.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertList.java
new file mode 100644
index 0000000000..dee6546cfe
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertList.java
@@ -0,0 +1,82 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+/**
+ * InsertList will sort ChangeOperation objects so that parents are inserted
+ * before children
+ *
+ *
+ */
+public class InsertList {
+
+ private HashMap opsByTableName = new HashMap();
+
+ private ArrayList insertOperations = new ArrayList();
+
+ private ArrayList order;
+
+ private static final boolean debug = false;
+
+ public void add(ChangeOperation op) {
+ DebugUtil.debugln(getClass(), debug, "Adding insert operation ");
+ // If nothing has been added yet, or this is no ordering, simply
+ // add the operation to the list
+ if ((order.size() == 0) || (op.getTableName() == null)) {
+ insertOperations.add(op);
+ } else {
+ String name = op.getTableName();
+ ArrayList ops = (ArrayList) opsByTableName.get(name);
+ if (ops == null)
+ ops = new ArrayList();
+
+ ops.add(op);
+ opsByTableName.put(name, ops);
+ }
+ }
+
+ public Collection getSortedList() {
+ DebugUtil.debugln(getClass(), debug, "Getting sorted insert list");
+ if ((order.size() > 0) && opsByTableName.keySet().size() > 0) {
+ Iterator i = this.order.iterator();
+ while (i.hasNext()) {
+ String name = (String) i.next();
+ DebugUtil.debugln(getClass(), debug,
+ "Adding operations for table " + name);
+ // A null here means a table is in the config but hasn't been changed here
+ if (opsByTableName.get(name) != null)
+ insertOperations.addAll((Collection) opsByTableName
+ .get(name));
+ }
+ }
+ DebugUtil.debugln(getClass(), debug, "Returning "
+ + insertOperations.size() + " insert operations");
+ return insertOperations;
+ }
+
+ public void setOrder(ArrayList insertOrder) {
+ this.order = insertOrder;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ManagedParameterImpl.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ManagedParameterImpl.java
new file mode 100644
index 0000000000..96a064b8e4
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ManagedParameterImpl.java
@@ -0,0 +1,17 @@
+package org.apache.tuscany.das.rdb.impl;
+
+public class ManagedParameterImpl extends ParameterImpl {
+
+ public void setValue(Object oldValue) {
+ this.value = updateValue(oldValue);
+ }
+
+ private Object updateValue(Object oldValue) {
+ if ( oldValue instanceof Integer)
+ return new Integer( ((Integer)oldValue).intValue() + 1);
+ else
+ throw new RuntimeException("Unsupported type for managed column: " + oldValue.getClass().getName());
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/OptimisticWriteCommandImpl.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/OptimisticWriteCommandImpl.java
new file mode 100644
index 0000000000..666e1186b5
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/OptimisticWriteCommandImpl.java
@@ -0,0 +1,52 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import java.sql.SQLException;
+
+import org.apache.tuscany.das.rdb.config.Update;
+
+public class OptimisticWriteCommandImpl extends UpdateCommandImpl {
+
+ public OptimisticWriteCommandImpl(String sqlString) {
+ super(sqlString);
+ }
+
+ public OptimisticWriteCommandImpl(Update update) {
+ super(update);
+ addParameters(update.getParameters());
+ }
+
+ public void execute() {
+
+ boolean success = false;
+ try {
+ int rowsAffected = statement.executeUpdate(parameters);
+ success = true;
+ if ( rowsAffected == 0 )
+ throw new RuntimeException("OCC Exception");
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ } finally {
+ if (success)
+ statement.getConnection().cleanUp();
+ else
+ statement.getConnection().errorCleanUp();
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/PagerImpl.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/PagerImpl.java
new file mode 100644
index 0000000000..32b17ef3e7
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/PagerImpl.java
@@ -0,0 +1,64 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.Pager;
+
+import commonj.sdo.DataObject;
+
+public class PagerImpl implements Pager {
+
+ private final ReadCommandImpl command;
+ private final int size;
+ private int idx = 1;
+
+ public PagerImpl(Command command, int size) {
+ this.command = (ReadCommandImpl)command;
+ this.command.enablePaging();
+ this.size = size;
+ }
+
+ public DataObject next() {
+ int start = idx;
+ int end = idx + size;
+ idx += size;
+ command.setStartRow(start);
+ command.setEndRow(end);
+ return command.executeQuery();
+ }
+
+ public DataObject getPage(int page) {
+ int end = (page * size) + 1;
+ int start = end - size;
+ idx = end;
+ command.setStartRow(start);
+ command.setEndRow(end);
+ return command.executeQuery();
+ }
+
+ public DataObject previous() {
+ int start = idx - (2 * size);
+ if ( start < 1 )
+ start = 1;
+ int end = start + size;
+ idx = end;
+ command.setStartRow(start);
+ command.setEndRow(end);
+ return command.executeQuery();
+ }
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterImpl.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterImpl.java
new file mode 100644
index 0000000000..f5c5d01375
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterImpl.java
@@ -0,0 +1,126 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import org.apache.tuscany.das.rdb.Converter;
+
+import commonj.sdo.Type;
+
+public class ParameterImpl {
+
+ /**
+ * Value for "Direction" that indicates that a parameter is soley for input.
+ */
+ final static int IN = 1;
+
+ /**
+ * Value for "Direction" that indicates that a parameter is soley for
+ * output. Out parameters only apply to Stored Procedures
+ */
+ final static int OUT = 2;
+
+ /**
+ * Value for "Direction" that indicates that a parameter is for both input
+ * and output. In-out parameters only apply to stored procedures
+ */
+ final static int IN_OUT = 3;
+
+ private int index;
+ private Type type;
+ private String name;
+ protected Object value = null;
+ private int direction = IN;
+ private Converter converter;
+
+ public ParameterImpl() {
+ super();
+ }
+
+ public ParameterImpl(String name) {
+ this.name = name;
+ }
+
+ public ParameterImpl(int index) {
+ this.index = index;
+ }
+
+
+ public void setType(Type type) {
+ this.type = type;
+ }
+
+ public void setIndex(int index) {
+ if ( index == 0 )
+ throw new RuntimeException("Index of zero not allowed");
+ this.index = index;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setValue(Object value) {
+ this.value = value;
+ }
+
+ public void setDirection(int direction) {
+ this.direction = direction;
+ }
+
+ public Type getType() {
+ return this.type;
+ }
+
+ public int getIndex() {
+ return this.index;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public Object getValue() {
+ if ( getConverter() != null ) {
+ return getConverter().getColumnValue(this.value);
+ } else {
+ return this.value;
+ }
+ }
+
+ public int getDirection() {
+ return this.direction;
+ }
+
+ public void setConverter(Converter converter) {
+ this.converter = converter;
+ }
+
+ public Converter getConverter() {
+ return this.converter;
+ }
+
+
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("Index: " + getIndex());
+ buffer.append("\nName: " + getName());
+ buffer.append("\nValue: " + getValue());
+ return buffer.toString();
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Parameters.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Parameters.java
new file mode 100644
index 0000000000..506d7285fe
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Parameters.java
@@ -0,0 +1,110 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+import commonj.sdo.Type;
+
+public class Parameters {
+
+ private ArrayList parameters = new ArrayList();
+
+ private ArrayList inParams = new ArrayList();
+
+ private ArrayList outParams = new ArrayList();
+
+ private static boolean debug = false;
+
+ public Parameters() {
+ super();
+ }
+
+ public ParameterImpl get(int index) {
+ return (ParameterImpl) parameters.get(index);
+ }
+
+ public List outParams() {
+ return outParams;
+ }
+
+ public List inParams() {
+ return inParams;
+ }
+
+ private void addParameter(ParameterImpl param) {
+ if (param.getDirection() == ParameterImpl.IN)
+ inParams.add(param);
+ else if ((param.getDirection() == ParameterImpl.OUT)
+ || (param.getDirection() == ParameterImpl.IN_OUT))
+ outParams.add(param);
+
+ this.parameters.add(param);
+ }
+
+ public void add(ParameterImpl param) {
+ addParameter(param);
+ }
+
+ public ParameterImpl findOrCreateParameterWithIndex(int index, int direction,
+ Type sdoType) {
+ Iterator i = parameters.iterator();
+ while (i.hasNext()) {
+ ParameterImpl param = (ParameterImpl) i.next();
+
+ if (param.getIndex() == index)
+ return param;
+ }
+ DebugUtil.debugln(getClass(), debug,
+ "Creating new parameter with index " + index);
+ ParameterImpl newParam = new ParameterImpl(index);
+ newParam.setDirection(direction);
+ newParam.setType(sdoType);
+ addParameter(newParam);
+ return newParam;
+ }
+
+ public List parameterList() {
+ return parameters;
+ }
+
+ public ParameterImpl findOrCreateParameterWithIndex(int index) {
+ return findOrCreateParameterWithIndex(index, ParameterImpl.IN, null);
+ }
+
+ public void setParameter(int index, Object value) {
+ ParameterImpl param = findOrCreateParameterWithIndex(index);
+ param.setValue(value);
+ }
+
+
+ public ParameterImpl parameterWithIndex(int index) {
+ Iterator i = parameters.iterator();
+ while (i.hasNext()) {
+ ParameterImpl param = (ParameterImpl) i.next();
+
+ if (param.getIndex() == index)
+ return param;
+ }
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/QueryString.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/QueryString.java
new file mode 100644
index 0000000000..d8a26057d1
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/QueryString.java
@@ -0,0 +1,86 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+
+public class QueryString {
+
+ private final String unmodifiedQueryString;
+ private final String preparedString;
+ private HashMap parameters = new HashMap();
+ private static final boolean debug = false;
+
+ public QueryString(String originalString) {
+ this.unmodifiedQueryString = originalString;
+ this.preparedString = replaceNamesAndSetIndexes(originalString);
+ }
+
+ public String getPreparedString() {
+ return this.preparedString;
+ }
+
+ public String getUnmodifiedString() {
+ return this.unmodifiedQueryString;
+ }
+
+ public int getParameterIndex(String name) {
+ DebugUtil.debugln(getClass(), debug, "Looking for parameter index for: " + name);
+ return ((Integer)parameters.get(name)).intValue();
+ }
+
+ private String replaceNamesAndSetIndexes(String query) {
+ DebugUtil.debugln(getClass(), debug, "Parameterizing query: " + query);
+ Pattern p = Pattern.compile(":[\\S&&[^,()]]*");
+ Matcher m = p.matcher(query);
+
+ int index = 1;
+ while (m.find()) {
+ parameters.put(m.group().substring(1), new Integer(index));
+ query = m.replaceFirst("?");
+ m = p.matcher(query);
+ index++;
+ }
+
+ DebugUtil.debugln(getClass(), debug, "Parameterized query: " + query);
+ return query;
+ }
+
+
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("\nOriginal SQL: ");
+ buffer.append(unmodifiedQueryString);
+ buffer.append("\nPrepared SQL: ");
+ buffer.append(preparedString);
+ buffer.append("\nParameters: ");
+ Iterator i = parameters.keySet().iterator();
+ while ( i.hasNext() ) {
+ String key = (String)i.next();
+ buffer.append("\n");
+ buffer.append(key);
+ }
+ return buffer.toString();
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ReadCommandImpl.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ReadCommandImpl.java
new file mode 100644
index 0000000000..d70f1e5693
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ReadCommandImpl.java
@@ -0,0 +1,127 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.das.rdb.config.Config;
+import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper;
+import org.apache.tuscany.das.rdb.graphbuilder.impl.GraphBuilderMetadata;
+import org.apache.tuscany.das.rdb.graphbuilder.impl.ResultSetProcessor;
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import commonj.sdo.ChangeSummary;
+import commonj.sdo.DataGraph;
+import commonj.sdo.DataObject;
+
+public class ReadCommandImpl extends CommandImpl {
+
+ private int startRow = 1;
+
+ private int endRow = Integer.MAX_VALUE;
+
+ public ReadCommandImpl(String sqlString, Config mapping, List resultDescriptor) {
+ super(sqlString);
+ if (mapping != null)
+ setMappingModel(mapping);
+
+ if ( resultDescriptor != null && !resultDescriptor.isEmpty())
+ this.resultSetShape = new ResultSetShape(resultDescriptor);
+ }
+
+
+ public void execute() {
+ throw new UnsupportedOperationException();
+ }
+
+ public DataObject executeQuery() {
+
+ if (statement.getConnection() == null)
+ throw new RuntimeException("A DASConnection object must be specified before executing the query.");
+
+ boolean success = false;
+ try {
+ ResultSet rs = statement.executeQuery(parameters);
+ success = true;
+ return buildGraph(rs);
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ } finally {
+ if (success)
+ statement.getConnection().cleanUp();
+ else
+ statement.getConnection().errorCleanUp();
+ }
+ }
+
+ protected DataObject buildGraph(ResultSet result) throws SQLException {
+
+ List results = new ArrayList();
+ results.add(result);
+
+ // Before we use the mappingModel, do some checking/updating. If
+ // inferrable information
+ // isn't specified, add it in.
+
+ GraphBuilderMetadata gbmd = new GraphBuilderMetadata(results, configWrapper.getConfig(),
+ resultSetShape);
+
+ // Create the DataGraph
+ DataGraph g = SDOUtil.createDataGraph();
+
+ // Create the root object
+ g.createRootObject(gbmd.getSchema());
+
+ ChangeSummary summary = g.getChangeSummary();
+
+ ResultSetProcessor rsp = new ResultSetProcessor(g.getRootObject(), gbmd);
+ rsp.processResults(getStartRow(), getEndRow());
+
+ summary.beginLogging();
+
+ return g.getRootObject();
+ }
+
+
+ protected int getStartRow() {
+ return startRow;
+ }
+
+ protected int getEndRow() {
+ return endRow;
+ }
+
+ protected void setStartRow(int startRow) {
+ this.startRow = startRow;
+ }
+
+ protected void setEndRow(int endRow) {
+ this.endRow = endRow;
+ }
+
+ private void setMappingModel(Config config) {
+ configWrapper = new MappingWrapper(config);
+ }
+
+ protected void enablePaging() {
+ statement.enablePaging();
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ResultSetShape.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ResultSetShape.java
new file mode 100644
index 0000000000..2f1567c1cf
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ResultSetShape.java
@@ -0,0 +1,118 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.List;
+
+import org.apache.tuscany.das.rdb.config.ResultDescriptor;
+import org.apache.tuscany.das.rdb.graphbuilder.schema.ResultSetTypeMap;
+
+import commonj.sdo.Type;
+import commonj.sdo.helper.TypeHelper;
+
+/**
+ * Describes the structure of the result set returned from execution
+ * of a SELECT statement. This description is typcially not required since the
+ * shape can be retreived from the JDBC ResultSetMetadata. However, some platforms
+ * such as Oracle do not support fully suport ResultSetMedata.
+ * <p>
+ * There may also be a performance boost when using this interface.
+ *
+ *
+ */
+public class ResultSetShape {
+
+ private final String[] columns;
+ private final String[] tables;
+ private final Type[] types;
+
+ public ResultSetShape(ResultSetMetaData metadata) throws SQLException {
+ columns = new String[metadata.getColumnCount()];
+ tables = new String[metadata.getColumnCount()];
+ types = new Type[metadata.getColumnCount()];
+
+ ResultSetTypeMap typeMap = ResultSetTypeMap.instance;
+ for (int i = 1; i <= metadata.getColumnCount(); i++) {
+ tables[i-1] = metadata.getTableName(i);
+ columns[i-1] = metadata.getColumnName(i);
+ types[i-1] = typeMap.getType(metadata.getColumnType(i), true);
+ }
+ }
+
+ public ResultSetShape(List resultDescriptor) {
+ TypeHelper helper = TypeHelper.INSTANCE;
+ int size = resultDescriptor.size();
+ columns = new String[size];
+ tables = new String[size];
+ types = new Type[size];
+
+ for (int i=0; i<size; i++) {
+ ResultDescriptor desc = (ResultDescriptor) resultDescriptor.get(i);
+ tables[i] = desc.getTableName();
+ columns[i] = desc.getColumnName();
+
+
+ int idx = desc.getColumnType().lastIndexOf('.');
+ String uri = desc.getColumnType().substring(0, idx);
+ String typeName = desc.getColumnType().substring(idx+1);
+
+ types[i] = helper.getType(uri, typeName);
+ if ( types[i] == null )
+ throw new RuntimeException("Could not find type " + desc.getColumnType() + " for column " + desc.getColumnName());
+ }
+
+
+ }
+
+ public int getColumnCount() {
+ return columns.length;
+ }
+
+ public String getTableName(int i) {
+ return tables[i-1];
+ }
+
+ public String getColumnName(int i) {
+ return columns[i-1];
+ }
+
+ public Type getColumnType(int i) {
+ return types[i-1];
+ }
+
+
+ public String toString() {
+ StringBuffer result = new StringBuffer();
+ result.append(" column/table/type: ");
+ for (int i=0; i < columns.length; i++) {
+ result.append(columns[i]);
+ result.append('\t');
+ result.append(tables[i]);
+ result.append('\t');
+ if ( types[i] == null )
+ result.append("null");
+ else
+ result.append(types[i].getName());
+ result.append('\n');
+ }
+
+ return result.toString();
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypeHelper.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypeHelper.java
new file mode 100644
index 0000000000..49a06a358d
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypeHelper.java
@@ -0,0 +1,102 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import java.sql.Types;
+
+
+import commonj.sdo.Type;
+
+public class SDODataTypeHelper {
+
+ static public int sqlTypeFor(Type sdoType) {
+ if (sdoType == null)
+ return Types.OTHER;
+
+ if ( sdoType == SDODataTypes.BOOLEAN)
+ return Types.BOOLEAN;
+ else if ( sdoType == SDODataTypes.STRING)
+ return Types.VARCHAR;
+ else if ( sdoType == SDODataTypes.BYTE)
+ return Types.TINYINT;
+ else if ( sdoType == SDODataTypes.BYTES)
+ return Types.BINARY;
+ else if ( sdoType == SDODataTypes.CHARACTER)
+ return Types.CHAR;
+ else if ( sdoType == SDODataTypes.DATE)
+ return Types.DATE;
+ else if ( sdoType == SDODataTypes.DATETIME)
+ return Types.DATE;
+ else if ( sdoType == SDODataTypes.DAY )
+ return java.sql.Types.BINARY;
+ else if ( sdoType == SDODataTypes.DECIMAL )
+ return java.sql.Types.DECIMAL;
+ else if ( sdoType == SDODataTypes.DOUBLE )
+ return java.sql.Types.DOUBLE;
+ else if ( sdoType == SDODataTypes.DURATION )
+ return java.sql.Types.VARCHAR;
+ else if ( sdoType == SDODataTypes.FLOAT )
+ return java.sql.Types.REAL;
+ else if ( sdoType == SDODataTypes.INT )
+ return java.sql.Types.INTEGER;
+ else if ( sdoType == SDODataTypes.INTEGER )
+ return java.sql.Types.INTEGER;
+ else if ( sdoType == SDODataTypes.LONG )
+ return java.sql.Types.BIGINT;
+ else if ( sdoType == SDODataTypes.MONTH )
+ return java.sql.Types.VARCHAR;
+ else if ( sdoType == SDODataTypes.MONTHDAY )
+ return java.sql.Types.VARCHAR;
+ else if ( sdoType == SDODataTypes.OBJECT )
+ return java.sql.Types.JAVA_OBJECT;
+ else if ( sdoType == SDODataTypes.SHORT )
+ return java.sql.Types.SMALLINT;
+ else if ( sdoType == SDODataTypes.STRING )
+ return java.sql.Types.VARCHAR;
+ else if ( sdoType == SDODataTypes.STRINGS )
+ return java.sql.Types.OTHER;
+ else if ( sdoType == SDODataTypes.TIME )
+ return java.sql.Types.VARCHAR;
+ else if ( sdoType == SDODataTypes.URI )
+ return java.sql.Types.VARCHAR;
+ else if ( sdoType == SDODataTypes.YEAR )
+ return java.sql.Types.VARCHAR;
+ else if ( sdoType == SDODataTypes.YEARMONTH )
+ return java.sql.Types.VARCHAR;
+ else if ( sdoType == SDODataTypes.YEARMONTHDAY )
+ return java.sql.Types.VARCHAR;
+ else if ( sdoType == SDODataTypes.BOOLEANOBJECT )
+ return java.sql.Types.BOOLEAN;
+ else if ( sdoType == SDODataTypes.BYTEOBJECT )
+ return java.sql.Types.TINYINT;
+ else if ( sdoType == SDODataTypes.CHARACTEROBJECT )
+ return java.sql.Types.CHAR;
+ else if ( sdoType == SDODataTypes.DOUBLEOBJECT )
+ return java.sql.Types.DOUBLE;
+ else if ( sdoType == SDODataTypes.FLOATOBJECT )
+ return java.sql.Types.REAL;
+ else if ( sdoType == SDODataTypes.INTEGEROBJECT )
+ return java.sql.Types.INTEGER;
+ else if ( sdoType == SDODataTypes.LONGOBJECT )
+ return java.sql.Types.BIGINT;
+ else if ( sdoType == SDODataTypes.SHORTOBJECT )
+ return java.sql.Types.SMALLINT;
+ else
+ throw new RuntimeException("Not a valid SDO Type " + sdoType);
+
+ }
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypes.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypes.java
new file mode 100644
index 0000000000..1a9e2143ff
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypes.java
@@ -0,0 +1,64 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import commonj.sdo.Type;
+import commonj.sdo.helper.TypeHelper;
+
+/**
+ * Defines SDO data types. This is used primalirly to type stored procedure OUT parameters.
+ *
+ */public class SDODataTypes {
+
+ static TypeHelper helper = TypeHelper.INSTANCE;
+
+ final public static Type BOOLEAN = helper.getType("commonj.sdo", "Boolean");
+ final public static Type BYTE = helper.getType("commonj.sdo", "Byte");
+ final public static Type BYTES = helper.getType("commonj.sdo", "Bytes");
+ final public static Type CHARACTER = helper.getType("commonj.sdo", "Character");
+ final public static Type DATE = helper.getType("commonj.sdo", "Date");
+ final public static Type DATETIME = helper.getType("commonj.sdo", "Date");
+ final public static Type DAY = helper.getType("commonj.sdo", "Date");
+ final public static Type DECIMAL = helper.getType("commonj.sdo", "Float");
+ final public static Type DOUBLE =helper.getType("commonj.sdo", "Double");
+ final public static Type DURATION = helper.getType("commonj.sdo", "Date");
+ final public static Type FLOAT = helper.getType("commonj.sdo", "Float");
+ final public static Type INT = helper.getType("commonj.sdo", "Int");
+ final public static Type INTEGER = helper.getType("commonj.sdo", "Integer");
+ final public static Type LONG = helper.getType("commonj.sdo", "Long");
+ final public static Type MONTH = helper.getType("commonj.sdo", "Date");
+ final public static Type MONTHDAY = helper.getType("commonj.sdo", "Date");
+ final public static Type OBJECT = helper.getType("commonj.sdo", "Object");
+ final public static Type SHORT = helper.getType("commonj.sdo", "Short");
+ final public static Type STRING = helper.getType("commonj.sdo", "String");
+ final public static Type STRINGS = helper.getType("commonj.sdo", "String");
+ final public static Type TIME = helper.getType("commonj.sdo", "Date");
+ final public static Type URI = helper.getType("commonj.sdo", "String");
+ final public static Type YEAR = helper.getType("commonj.sdo", "Date");
+ final public static Type YEARMONTH = helper.getType("commonj.sdo", "Date");
+ final public static Type YEARMONTHDAY = helper.getType("commonj.sdo", "Date");
+ final public static Type BOOLEANOBJECT = helper.getType("commonj.sdo", "BooleanObject");
+ final public static Type BYTEOBJECT = helper.getType("commonj.sdo", "ByteObject");
+ final public static Type CHARACTEROBJECT = helper.getType("commonj.sdo", "CharacterObject");
+ final public static Type DOUBLEOBJECT = helper.getType("commonj.sdo", "DoubleObject");
+ final public static Type FLOATOBJECT = helper.getType("commonj.sdo", "FloatObject");
+ final public static Type INTEGEROBJECT = helper.getType("commonj.sdo", "IntObject");
+ final public static Type LONGOBJECT = helper.getType("commonj.sdo", "LongObject");
+ final public static Type SHORTOBJECT = helper.getType("commonj.sdo", "ShortObject");
+
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SPCommandImpl.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SPCommandImpl.java
new file mode 100644
index 0000000000..999cd0f267
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SPCommandImpl.java
@@ -0,0 +1,93 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.tuscany.das.rdb.config.Config;
+import org.apache.tuscany.das.rdb.config.Parameter;
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Type;
+import commonj.sdo.helper.TypeHelper;
+
+public class SPCommandImpl extends ReadCommandImpl {
+
+ public SPCommandImpl(String sqlString, Config config, List params) {
+ super(sqlString, config, null);
+ Iterator i = params.iterator();
+ for (int idx = 1; i.hasNext(); idx++) {
+ Parameter p = (Parameter) i.next();
+
+ int index = p.getColumnType().lastIndexOf('.');
+ String pkg = p.getColumnType().substring(0, index);
+ String typeName = p.getColumnType().substring(index + 1);
+
+ Type sdoType = TypeHelper.INSTANCE.getType(pkg, typeName);
+
+
+ int direction = ParameterImpl.IN;
+ if ("OUT".equalsIgnoreCase(p.getDirection()))
+ direction = ParameterImpl.OUT;
+ else if ("INOUT".equalsIgnoreCase(p.getDirection()))
+ direction = ParameterImpl.IN_OUT;
+ parameters.findOrCreateParameterWithIndex(idx, direction, sdoType);
+ }
+
+ }
+
+ public DataObject executeQuery() {
+
+ boolean success = false;
+ try {
+ ResultSet rs = statement.executeCall(parameters);
+ success = true;
+
+ return buildGraph(rs);
+ } catch (SQLException e) {
+ DebugUtil.debugln(getClass(), debug, e);
+ throw new RuntimeException(e);
+ } finally {
+ if (success)
+ statement.getConnection().cleanUp();
+ else
+ statement.getConnection().errorCleanUp();
+ }
+ }
+
+ public void execute() {
+
+ boolean success = false;
+ try {
+ statement.executeUpdateCall(parameters);
+ success = true;
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ } finally {
+ if (success)
+ statement.getConnection().cleanUp();
+ else
+ statement.getConnection().errorCleanUp();
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Statement.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Statement.java
new file mode 100644
index 0000000000..f40f04489a
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Statement.java
@@ -0,0 +1,210 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import java.sql.CallableStatement;
+import java.sql.ParameterMetaData;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Iterator;
+
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+// TODO - Can use some refactoring. Much code is duplicated in "execute" methods
+public class Statement {
+
+ protected final String queryString;
+
+ protected ConnectionImpl jdbcConnection;
+
+ private static final boolean debug = false;
+
+ private PreparedStatement preparedStatement;
+
+ private boolean isPaging = false;
+
+ public Statement(String sqlString) {
+ this.queryString = sqlString; //new QueryString(sqlString);
+ }
+
+ public ResultSet executeQuery(Parameters parameters) throws SQLException {
+
+ PreparedStatement ps = getPreparedStatement();
+ ps = setParameters(ps, parameters);
+ ResultSet rs = ps.executeQuery();
+
+ return rs;
+ }
+
+ public ResultSet executeCall(Parameters parameters) throws SQLException {
+ try {
+ CallableStatement cs = jdbcConnection.prepareCall(queryString);
+
+ Iterator inParams = parameters.inParams().iterator();
+ while (inParams.hasNext()) {
+ ParameterImpl param = (ParameterImpl) inParams.next();
+// if (param.getIndex() == 0)
+// param.setIndex(queryString.getParameterIndex(param.getName()));
+ cs.setObject(param.getIndex(), param.getValue());
+ }
+
+ // register out parameters
+ Iterator outParams = parameters.outParams().iterator();
+ while (outParams.hasNext()) {
+ ParameterImpl param = (ParameterImpl) outParams.next();
+// if (param.getIndex() == 0)
+// param.setIndex(queryString.getParameterIndex(param.getName()));
+ DebugUtil.debugln(getClass(), debug, "Registering parameter " + param.getName());
+ cs.registerOutParameter(param.getIndex(), SDODataTypeHelper.sqlTypeFor(param.getType()));
+ }
+
+ // Using execute because Derby does not currenlty support
+ // executeQuery
+ // for SP
+ cs.execute();
+ ResultSet results = cs.getResultSet();
+
+ Iterator i = parameters.outParams().iterator();
+ while (i.hasNext()) {
+ ParameterImpl param = (ParameterImpl) i.next();
+ param.setValue(cs.getObject(param.getIndex()));
+ }
+
+ return results;
+ } catch (SQLException ex) {
+ ex.printStackTrace();
+ throw ex;
+ }
+
+ }
+
+ public void executeUpdateCall(Parameters parameters) throws SQLException {
+ CallableStatement cs = jdbcConnection.prepareCall(queryString);
+
+ Iterator inParams = parameters.inParams().iterator();
+ while (inParams.hasNext()) {
+ ParameterImpl param = (ParameterImpl) inParams.next();
+// if (param.getIndex() == 0)
+// param.setIndex(queryString.getParameterIndex(param.getName()));
+ cs.setObject(param.getIndex(), param.getValue());
+ }
+
+ // register out parameters
+ Iterator outParams = parameters.outParams().iterator();
+ while (outParams.hasNext()) {
+ ParameterImpl param = (ParameterImpl) outParams.next();
+// if (param.getIndex() == 0)
+// param.setIndex(queryString.getParameterIndex(param.getName()));
+ DebugUtil.debugln(getClass(), debug, "Registering parameter " + param.getName());
+ cs.registerOutParameter(param.getIndex(), SDODataTypeHelper.sqlTypeFor(param.getType()));
+ }
+
+ cs.execute();
+
+ Iterator out = parameters.outParams().iterator();
+ while (out.hasNext()) {
+ ParameterImpl param = (ParameterImpl) out.next();
+ param.setValue(cs.getObject(param.getIndex()));
+ }
+
+ }
+
+ /**
+ * TODO - We need to look at using specific ps.setXXX methods when a type
+ * has been specified and try setObject otherwise.
+ */
+ public int executeUpdate(Parameters parameters) throws SQLException {
+ DebugUtil.debugln(getClass(), debug, "Executing statement " + queryString);
+ PreparedStatement ps = getPreparedStatement();
+ Iterator i = parameters.inParams().iterator();
+ while (i.hasNext()) {
+ ParameterImpl param = (ParameterImpl) i.next();
+
+// if (param.getIndex() == 0)
+// param.setIndex(queryString.getParameterIndex(param.getName()));
+ Object value = param.getValue();
+ DebugUtil.debugln(getClass(), debug, "Setting parameter " + param.getIndex() + " to " + value);
+ if (value == null) {
+ if (param.getType() == null) {
+ ParameterMetaData pmd = ps.getParameterMetaData();
+ ps.setNull(param.getIndex(), pmd.getParameterType(param.getIndex()));
+ } else
+ ps.setNull(param.getIndex(), SDODataTypeHelper.sqlTypeFor(param.getType()));
+ } else {
+ ps.setObject(param.getIndex(), value);
+ }
+ }
+ return ps.executeUpdate();
+ }
+
+ protected PreparedStatement setParameters(PreparedStatement ps, Parameters parameters) throws SQLException {
+ Iterator i = parameters.inParams().iterator();
+ while (i.hasNext()) {
+ ParameterImpl param = (ParameterImpl) i.next();
+// if (param.getIndex() == 0)
+// param.setIndex(queryString.getParameterIndex(param.getName()));
+ ps.setObject(param.getIndex(), param.getValue());
+ }
+ return ps;
+ }
+
+ public void setConnection(ConnectionImpl jdbcConnection) {
+ this.jdbcConnection = jdbcConnection;
+ }
+
+ public ConnectionImpl getConnection() {
+ return this.jdbcConnection;
+ }
+
+ private PreparedStatement getPreparedStatement() throws SQLException {
+ DebugUtil.debugln(getClass(), debug, "Getting prepared statement");
+ if (preparedStatement == null)
+ if (isPaging)
+ preparedStatement = jdbcConnection.preparePagedStatement(queryString);
+ else
+ preparedStatement = jdbcConnection.prepareStatement(queryString);
+
+ return preparedStatement;
+ }
+
+ public Integer getGeneratedKey() throws SQLException {
+
+ ResultSet rs = getPreparedStatement().getGeneratedKeys();
+ if (rs.next())
+ return new Integer(rs.getInt(1));
+
+ return null;
+ }
+
+ protected void enablePaging() {
+ isPaging = true;
+ }
+
+ public void close() {
+
+ if (this.preparedStatement != null) {
+ try {
+ preparedStatement.close();
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateCommandImpl.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateCommandImpl.java
new file mode 100644
index 0000000000..963cb4d847
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateCommandImpl.java
@@ -0,0 +1,32 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import org.apache.tuscany.das.rdb.config.Update;
+
+public class UpdateCommandImpl extends WriteCommandImpl {
+
+ public UpdateCommandImpl(String sqlString) {
+ super(sqlString);
+ }
+
+ public UpdateCommandImpl(Update update) {
+ super(update.getSql());
+ addParameters(update.getParameters());
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateList.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateList.java
new file mode 100644
index 0000000000..1ab2f16fca
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateList.java
@@ -0,0 +1,42 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * Updates don't have to be sorted, so this class is a simple wrapper of ArrayList.
+ *
+ */
+public class UpdateList {
+
+ private ArrayList updates = new ArrayList();
+
+ public UpdateList() {
+ super();
+ }
+
+ public void add(ChangeOperation c) {
+ updates .add(c);
+ }
+
+ public Collection getSortedList() {
+ return updates;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateOperation.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateOperation.java
new file mode 100644
index 0000000000..cbe73a16e4
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateOperation.java
@@ -0,0 +1,30 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.impl;
+
+
+import commonj.sdo.DataObject;
+
+
+public class UpdateOperation extends ChangeOperation {
+
+ public UpdateOperation(UpdateCommandImpl command, DataObject changedObject, String id) {
+ super(command, changedObject);
+ this.propagatedID = id;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/WriteCommandImpl.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/WriteCommandImpl.java
new file mode 100644
index 0000000000..386af87141
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/WriteCommandImpl.java
@@ -0,0 +1,101 @@
+/**
+*
+* Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.tuscany.das.rdb.impl;
+
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.StringTokenizer;
+
+import org.apache.tuscany.das.rdb.config.Config;
+
+import commonj.sdo.DataObject;
+
+public abstract class WriteCommandImpl extends CommandImpl {
+
+
+ public WriteCommandImpl(String sqlString) {
+ super(sqlString);
+ }
+
+ public void execute() {
+
+ boolean success = false;
+ try {
+ statement.executeUpdate(parameters);
+ subtypeProcessing();
+ success = true;
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ } finally {
+ if (success)
+ statement.getConnection().cleanUp();
+ else
+ statement.getConnection().errorCleanUp();
+ }
+
+ }
+
+ public DataObject executeQuery() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Config getMappingModel() {
+ return configWrapper.getConfig();
+ }
+
+
+ /**
+ * Subclasses add specific bahavior
+ * Default is to do nothing
+ */
+ protected void subtypeProcessing() throws SQLException {
+ if ( false )
+ throw new SQLException();
+ }
+
+ public String toString() {
+
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("\nSQL: " + statement.queryString);
+
+ return buffer.toString();
+ }
+
+ public int getGeneratedKey() {
+ throw new RuntimeException("No generated key is available");
+ }
+
+ public void addParameters(String parameters) {
+ StringTokenizer tokenizer = new StringTokenizer(parameters);
+ for (int idx=1; tokenizer.hasMoreTokens(); idx++) {
+ ParameterImpl p = new ParameterImpl();
+ p.setName(tokenizer.nextToken());
+ p.setIndex(idx);
+ addParameter(p);
+ }
+ }
+ public void addParameters(Collection updateParameters) {
+ Iterator i = updateParameters.iterator();
+ while ( i.hasNext()) {
+ ParameterImpl p = (ParameterImpl) i.next();
+ addParameter(p);
+ }
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/merge/impl/GraphMerger.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/merge/impl/GraphMerger.java
new file mode 100644
index 0000000000..b032fb6926
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/merge/impl/GraphMerger.java
@@ -0,0 +1,166 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.merge.impl;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.das.rdb.config.wrapper.QualifiedColumn;
+import org.apache.tuscany.das.rdb.graphbuilder.impl.MultiTableRegistry;
+import org.apache.tuscany.das.rdb.graphbuilder.impl.TableRegistry;
+import org.apache.tuscany.sdo.impl.ChangeSummaryImpl;
+
+import commonj.sdo.ChangeSummary;
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+
+public class GraphMerger {
+
+ private HashMap keys = new HashMap();
+
+ private TableRegistry registry = new MultiTableRegistry();
+
+ private static Logger logger = Logger.getLogger("GraphMerger");
+
+ //TODO lots of cleanup/design
+ public GraphMerger() {
+ // Empty Constructor
+ }
+
+ public DataObject merge(List graphs) {
+ DataObject primaryGraph = (DataObject) graphs.get(0);
+
+ Iterator i = graphs.iterator();
+ if (i.hasNext())
+ i.next();
+ while (i.hasNext()) {
+ primaryGraph = merge(primaryGraph, (DataObject) i.next());
+ }
+
+ return primaryGraph;
+ }
+
+ public DataObject merge(DataObject primary, DataObject secondary) {
+ addGraphToRegistry(primary);
+
+ ChangeSummary summary = primary
+ .getDataGraph().getChangeSummary();
+ summary.endLogging();
+ Iterator i = secondary.getType().getProperties().iterator();
+
+ while (i.hasNext()) {
+ Property p = (Property) i.next();
+
+ Iterator objects = secondary.getList(p.getName()).iterator();
+ while (objects.hasNext()) {
+ DataObject object = (DataObject) objects.next();
+ createObjectWithSubtree(primary, p, object);
+ }
+ }
+ ((ChangeSummaryImpl)summary).resumeLogging();
+ return primary;
+ }
+
+ private void createObjectWithSubtree(DataObject root, Property p,
+ DataObject object) {
+ Object pk = getPrimaryKey(object);
+
+ if (!registry.contains(object.getType().getName(), Collections
+ .singletonList(pk))) {
+ // logger.info("creating " + object.getType().getName() + " with pk " + pk);
+ DataObject newObject = root.createDataObject(p.getName());
+
+
+
+ Iterator attrs = object.getType().getProperties().iterator();
+ while (attrs.hasNext()) {
+ Property attr = (Property) attrs.next();
+ if ( attr.getType().isDataType()) {
+ newObject.set(attr.getName(), object.get(attr));
+ }
+ }
+ registry.put(object.getType().getName(), Collections
+ .singletonList(pk), newObject);
+
+ Iterator refs = object.getType().getProperties().iterator();
+ while (refs.hasNext()) {
+ Property ref = (Property) refs.next();
+ if ( !ref.getType().isDataType()) {
+ List refObjects;
+ if (!ref.isMany()) {
+ refObjects = Collections.singletonList(object.get(ref));
+ } else {
+ refObjects = (List) object.get(ref);
+ }
+
+ Iterator iter = refObjects.iterator();
+ while (iter.hasNext()) {
+ DataObject refObject = (DataObject) iter.next();
+ createObjectWithSubtree(root, refObject
+ .getContainmentProperty(), refObject);
+
+ refObject = registry.get(refObject.getType().getName(), Collections.singletonList(getPrimaryKey(refObject)));
+ if (ref.isMany()) {
+ newObject.getList(
+ newObject.getType().getProperty(ref.getName()))
+ .add(refObject);
+ } else
+ newObject.set(newObject.getType().getProperty(
+ ref.getName()), refObject);
+ }
+ }
+
+ }
+
+ }
+
+ }
+
+ private void addGraphToRegistry(DataObject graph1) {
+ Iterator i = graph1.getType().getProperties().iterator();
+ while (i.hasNext()) {
+ Property p = (Property) i.next();
+ Iterator objects = graph1.getList(p).iterator();
+ while (objects.hasNext()) {
+ DataObject object = (DataObject) objects.next();
+ Object pk = object.get(getPrimaryKeyName(object));
+ logger.finest("Adding object with pk " + pk + " to registry");
+ registry.put(object.getType().getName(), Collections
+ .singletonList(pk), object);
+ }
+ }
+ }
+
+ private Object getPrimaryKey(DataObject object) {
+ String pkName = getPrimaryKeyName(object);
+ return object.get(pkName);
+ }
+
+ private String getPrimaryKeyName(DataObject object) {
+ return (String) keys.get(object.getType().getName());
+ }
+
+ public void addPrimaryKey(String key) {
+ QualifiedColumn column = new QualifiedColumn(key);
+ logger.finest("Adding " + column.getTableName() + " "
+ + column.getColumnName() + " to keys");
+ keys.put(column.getTableName(), column.getColumnName());
+ }
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/ConfigUtil.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/ConfigUtil.java
new file mode 100644
index 0000000000..46db6ca728
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/ConfigUtil.java
@@ -0,0 +1,51 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.tuscany.das.rdb.config.Config;
+import org.apache.tuscany.das.rdb.config.ConfigFactory;
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import commonj.sdo.helper.XMLHelper;
+
+/**
+ * Config util provides config-related utilities such as loading a Config
+ * instance from an InputStream
+ *
+ */
+public class ConfigUtil {
+
+ public static Config loadConfig(InputStream configStream) {
+
+ if (configStream == null)
+ throw new RuntimeException(
+ "Cannot load configuration from a null InputStream. Possibly caused by an incorrect config xml file name");
+
+ SDOUtil.registerStaticTypes(ConfigFactory.class);
+ XMLHelper helper = XMLHelper.INSTANCE;
+
+ try {
+ return (Config) helper.load(configStream).getRootObject();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DataObjectUtil.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DataObjectUtil.java
new file mode 100644
index 0000000000..7f96f9aef4
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DataObjectUtil.java
@@ -0,0 +1,73 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.util;
+
+import java.util.Iterator;
+import java.util.List;
+
+import commonj.sdo.ChangeSummary;
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.ChangeSummary.Setting;
+import commonj.sdo.helper.DataFactory;
+
+/**
+ */
+public class DataObjectUtil {
+
+ //Utilities
+ public static DataObject getRestoredCopy(DataObject changedDO) {
+ DataObject changedCopy = getCopy(changedDO);
+ restoreAttributeValues(changedCopy, changedDO);
+ return changedCopy;
+ }
+
+ public static DataObject getCopy(DataObject original) {
+
+ DataObject copy = DataFactory.INSTANCE.create(original.getType());
+
+ //Fill in values
+ Iterator i = original.getType().getProperties().iterator();
+ while (i.hasNext()) {
+ Property feature = (Property) i.next();
+ copy.set(feature, original.get(feature));
+ }
+ return copy;
+ }
+
+ /**
+ * @param changedCopy
+ * @return
+ */
+ private static void restoreAttributeValues(DataObject changedCopy, DataObject changedDO) {
+
+ ChangeSummary changeSummary = changedDO.getDataGraph().getChangeSummary();
+ List changes = changeSummary.getOldValues(changedDO);
+ if ( changes == null )
+ return;
+
+ Iterator i = changes.iterator();
+ while (i.hasNext()) {
+ Setting s = (Setting) i.next();
+ if ( s.getProperty().getType().isDataType() )
+ changedCopy.set(s.getProperty(), s.getValue());
+ }
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DebugFormatter.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DebugFormatter.java
new file mode 100644
index 0000000000..ed2e1063d6
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DebugFormatter.java
@@ -0,0 +1,34 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.util;
+
+import java.util.logging.Formatter;
+import java.util.logging.LogRecord;
+
+public class DebugFormatter extends Formatter {
+
+ public String format(LogRecord record) {
+ StringBuffer message = new StringBuffer();
+ message.append("[");
+ message.append(record.getSourceClassName());
+ message.append("] ");
+ message.append(record.getMessage());
+ message.append("\n");
+ return message.toString();
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DebugUtil.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DebugUtil.java
new file mode 100644
index 0000000000..745fe8cb7e
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DebugUtil.java
@@ -0,0 +1,66 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.util;
+
+import java.util.logging.ConsoleHandler;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+//TODO Restructure Logging
+public class DebugUtil {
+
+ private static StringBuffer buffer = new StringBuffer();
+ private static final Logger logger = Logger.getAnonymousLogger();
+
+ static {
+ logger.setUseParentHandlers(false);
+ Handler h = new ConsoleHandler();
+ h.setFormatter(new DebugFormatter());
+ logger.addHandler(h);
+ }
+ public static void debugln(Class c, boolean flag, Object obj) {
+
+ if ( flag ) {
+ logger.logp(Level.INFO, getClassName(c), null, obj.toString() );
+ }
+ }
+
+ public static void debug(Class c, boolean flag, Object obj) {
+ if ( flag ) {
+ System.out.print("[" + getClassName(c) + "] " + obj );
+ }
+ }
+
+ public static void buffer(boolean flag, Object obj) {
+ if ( flag )
+ buffer.append(obj);
+ }
+
+ public static void flushBuffer(Class c, boolean flag) {
+ if ( flag ) {
+ System.out.println("[" + getClassName(c) + "] " + buffer.toString());
+ buffer = new StringBuffer();
+ }
+ }
+
+ private static String getClassName(Class c) {
+ String className = c.getName();
+ return className.substring(className.lastIndexOf(".") + 1);
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000000..25d78feeac
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,1277 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+APACHE TUSCANY SUBCOMPONENTS:
+
+The Apache Tuscany distribution includes a number of subcomponents with
+separate copyright notices and license terms. Your use of the source
+code for the these subcomponents is subject to the terms and
+conditions of the following licenses.
+
+===============================================================================
+
+For the Eclipse Modeling Framework component and the Celtix binding:
+
+Eclipse Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF
+THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and
+documentation distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and
+are distributed by that particular Contributor. A Contribution
+'originates' from a Contributor if it was added to the Program by such
+Contributor itself or anyone acting on such Contributor's behalf.
+Contributions do not include additions to the Program which: (i) are
+separate modules of software distributed in conjunction with the
+Program under their own license agreement, and (ii) are not derivative
+works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor
+which are necessarily infringed by the use or sale of its Contribution
+alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this
+Agreement.
+
+"Recipient" means anyone who receives the Program under this
+Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby
+grants Recipient a non-exclusive, worldwide, royalty-free copyright
+license to reproduce, prepare derivative works of, publicly display,
+publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and
+object code form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby
+grants Recipient a non-exclusive, worldwide, royalty-free patent
+license under Licensed Patents to make, use, sell, offer to sell,
+import and otherwise transfer the Contribution of such Contributor, if
+any, in source code and object code form. This patent license shall
+apply to the combination of the Contribution and the Program if, at
+the time the Contribution is added by the Contributor, such addition
+of the Contribution causes such combination to be covered by the
+Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the
+licenses to its Contributions set forth herein, no assurances are
+provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow
+Recipient to distribute the Program, it is Recipient's responsibility
+to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient
+copyright rights in its Contribution, if any, to grant the copyright
+license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form
+under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties
+and conditions, express and implied, including warranties or
+conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability
+for damages, including direct, indirect, special, incidental and
+consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are
+offered by that Contributor alone and not by any other party; and
+
+iv) states that source code for the Program is available from such
+Contributor, and informs licensees how to obtain it in a reasonable
+manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the
+Program.
+
+Contributors may not remove or alter any copyright notices contained
+within the Program.
+
+Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a
+commercial product offering should do so in a manner which does not
+create potential liability for other Contributors. Therefore, if a
+Contributor includes the Program in a commercial product offering,
+such Contributor ("Commercial Contributor") hereby agrees to defend
+and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising
+from claims, lawsuits and other legal actions brought by a third party
+against the Indemnified Contributor to the extent caused by the acts
+or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement.
+In order to qualify, an Indemnified Contributor must: a) promptly
+notify the Commercial Contributor in writing of such claim, and b)
+allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement
+negotiations. The Indemnified Contributor may participate in any such
+claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
+WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable
+laws, damage to or loss of data, programs or equipment, and
+unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR
+ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further
+action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+the Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of
+the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of
+time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use
+and distribution of the Program as soon as reasonably practicable.
+However, Recipient's obligations under this Agreement and any licenses
+granted by Recipient relating to the Program shall continue and
+survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement,
+but in order to avoid inconsistency the Agreement is copyrighted and
+may only be modified in the following manner. The Agreement Steward
+reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement
+Steward has the right to modify this Agreement. The Eclipse Foundation
+is the initial Agreement Steward. The Eclipse Foundation may assign
+the responsibility to serve as the Agreement Steward to a suitable
+separate entity. Each new version of the Agreement will be given a
+distinguishing version number. The Program (including Contributions)
+may always be distributed subject to the version of the Agreement
+under which it was received. In addition, after a new version of the
+Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives
+no rights or licenses to the intellectual property of any Contributor
+under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No
+party to this Agreement will bring a legal action under this Agreement
+more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.
+
+===============================================================================
+
+For the Rhino JavaScript container component:
+
+Mozilla Public License 1.1 (MPL 1.1)
+
+1. Definitions.
+
+ 1.0.1. "Commercial Use" means distribution or otherwise making the
+Covered Code available to a third party.
+
+ 1.1. "Contributor" means each entity that creates or contributes to
+the creation of Modifications.
+
+ 1.2. "Contributor Version" means the combination of the Original Code,
+prior Modifications used by a Contributor, and the Modifications made by that
+particular Contributor.
+
+ 1.3. "Covered Code" means the Original Code or Modifications or the
+combination of the Original Code and Modifications, in each case including
+portions thereof.
+
+ 1.4. "Electronic Distribution Mechanism" means a mechanism generally
+accepted in the software development community for the electronic transfer of
+data.
+
+ 1.5. "Executable" means Covered Code in any form other than Source
+Code.
+
+ 1.6. "Initial Developer" means the individual or entity identified as
+the Initial Developer in the Source Code notice required by Exhibit A.
+
+ 1.7. "Larger Work" means a work which combines Covered Code or
+portions thereof with code not governed by the terms of this License.
+
+ 1.8. "License" means this document.
+
+ 1.8.1. "Licensable" means having the right to grant, to the maximum
+extent possible, whether at the time of the initial grant or subsequently
+acquired, any and all of the rights conveyed herein.
+
+ 1.9. "Modifications" means any addition to or deletion from the
+substance or structure of either the Original Code or any previous
+Modifications. When Covered Code is released as a series of files, a
+Modification is:
+ A. Any addition to or deletion from the contents of a file
+containing Original Code or previous Modifications.
+
+ B. Any new file that contains any part of the Original Code or
+previous Modifications.
+
+ 1.10. "Original Code" means Source Code of computer software code
+which is described in the Source Code notice required by Exhibit A as Original
+Code, and which, at the time of its release under this License is not already
+Covered Code governed by this License.
+
+ 1.10.1. "Patent Claims" means any patent claim(s), now owned or
+hereafter acquired, including without limitation, method, process, and
+apparatus claims, in any patent Licensable by grantor.
+
+ 1.11. "Source Code" means the preferred form of the Covered Code for
+making modifications to it, including all modules it contains, plus any
+associated interface definition files, scripts used to control compilation and
+installation of an Executable, or source code differential comparisons against
+either the Original Code or another well known, available Covered Code of the
+Contributor's choice. The Source Code can be in a compressed or archival form,
+provided the appropriate decompression or de-archiving software is widely
+available for no charge.
+
+ 1.12. "You" (or "Your") means an individual or a legal entity
+exercising rights under, and complying with all of the terms of, this License
+or a future version of this License issued under Section 6.1. For legal
+entities, "You" includes any entity which controls, is controlled by, or is
+under common control with You. For purposes of this definition, "control"
+means (a) the power, direct or indirect, to cause the direction or management
+of such entity, whether by contract or otherwise, or (b) ownership of more
+than fifty percent (50%) of the outstanding shares or beneficial ownership of
+such entity.
+
+2. Source Code License.
+
+ 2.1. The Initial Developer Grant.
+ The Initial Developer hereby grants You a world-wide, royalty-free,
+non-exclusive license, subject to third party intellectual property claims:
+ (a) under intellectual property rights (other than patent or
+trademark) Licensable by Initial Developer to use, reproduce, modify, display,
+perform, sublicense and distribute the Original Code (or portions thereof)
+with or without Modifications, and/or as part of a Larger Work; and
+
+ (b) under Patents Claims infringed by the making, using or selling
+of Original Code, to make, have made, use, practice, sell, and offer for sale,
+and/or otherwise dispose of the Original Code (or portions thereof).
+ (c) the licenses granted in this Section 2.1(a) and
+(b) are effective on the date Initial Developer first distributes Original
+Code under the terms of this License.
+
+ (d) Notwithstanding Section 2.1(b) above, no patent license is
+granted: 1) for code that You delete from the Original Code; 2) separate from
+the Original Code; or 3) for infringements caused by: i) the modification of
+the Original Code or ii) the combination of the Original Code with other
+software or devices.
+
+ 2.2. Contributor Grant.
+ Subject to third party intellectual property claims, each Contributor
+hereby grants You a world-wide, royalty-free, non-exclusive license
+
+ (a) under intellectual property rights (other than patent or
+trademark) Licensable by Contributor, to use, reproduce, modify, display,
+perform, sublicense and distribute the Modifications created by such
+Contributor (or portions thereof) either on an unmodified basis, with other
+Modifications, as Covered Code and/or as part of a Larger Work; and
+
+ (b) under Patent Claims infringed by the making, using, or selling
+of Modifications made by that Contributor either alone and/or in combination
+with its Contributor Version (or portions of such combination), to make, use,
+sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications
+made by that Contributor (or portions thereof); and 2) the combination of
+Modifications made by that Contributor with its Contributor Version (or
+portions of such combination).
+
+ (c) the licenses granted in Sections 2.2(a) and 2.2(b) are
+effective on the date Contributor first makes Commercial Use of the Covered
+Code.
+
+ (d) Notwithstanding Section 2.2(b) above, no patent license is
+granted: 1) for any code that Contributor has deleted from the Contributor
+Version; 2) separate from the Contributor Version; 3) for infringements
+caused by: i) third party modifications of Contributor Version or ii) the
+combination of Modifications made by that Contributor with other software
+(except as part of the Contributor Version) or other devices; or 4) under
+Patent Claims infringed by Covered Code in the absence of Modifications made
+by that Contributor.
+
+
+3. Distribution Obligations.
+
+ 3.1. Application of License.
+ The Modifications which You create or to which You contribute are
+governed by the terms of this License, including without limitation Section
+2.2. The Source Code version of Covered Code may be distributed only under the
+terms of this License or a future version of this License released under
+Section 6.1, and You must include a copy of this License with every copy of
+the Source Code You distribute. You may not offer or impose any terms on any
+Source Code version that alters or restricts the applicable version of this
+License or the recipients' rights hereunder. However, You may include an
+additional document offering the additional rights described in Section 3.5.
+
+ 3.2. Availability of Source Code.
+ Any Modification which You create or to which You contribute must be
+made available in Source Code form under the terms of this License either on
+the same media as an Executable version or via an accepted Electronic
+Distribution Mechanism to anyone to whom you made an Executable version
+available; and if made available via Electronic Distribution Mechanism, must
+remain available for at least twelve (12) months after the date it initially
+became available, or at least six (6) months after a subsequent version of
+that particular Modification has been made available to such recipients. You
+are responsible for ensuring that the Source Code version remains available
+even if the Electronic Distribution Mechanism is maintained by a third party.
+
+ 3.3. Description of Modifications.
+ You must cause all Covered Code to which You contribute to contain a
+file documenting the changes You made to create that Covered Code and the date
+of any change. You must include a prominent statement that the Modification is
+derived, directly or indirectly, from Original Code provided by the Initial
+Developer and including the name of the Initial Developer in (a) the Source
+Code, and (b) in any notice in an Executable version or related documentation
+in which You describe the origin or ownership of the Covered Code.
+
+ 3.4. Intellectual Property Matters
+ (a) Third Party Claims.
+ If Contributor has knowledge that a license under a third party's
+intellectual property rights is required to exercise the rights granted by
+such Contributor under Sections 2.1 or 2.2, Contributor must include a text
+file with the Source Code distribution titled "LEGAL" which describes the
+claim and the party making the claim in sufficient detail that a recipient
+will know whom to contact. If Contributor obtains such knowledge after the
+Modification is made available as described in Section 3.2, Contributor shall
+promptly modify the LEGAL file in all copies Contributor makes available
+thereafter and shall take other steps (such as notifying appropriate mailing
+lists or newsgroups) reasonably calculated to inform those who received the
+Covered Code that new knowledge has been obtained.
+
+ (b) Contributor APIs.
+ If Contributor's Modifications include an application programming
+interface and Contributor has knowledge of patent licenses which are
+reasonably necessary to implement that API, Contributor must also include this
+information in the LEGAL file.
+
+ (c) Representations.
+ Contributor represents that, except as disclosed pursuant to
+Section 3.4(a) above, Contributor believes that Contributor's Modifications
+are Contributor's original creation(s) and/or Contributor has sufficient
+rights to grant the rights conveyed by this License.
+
+
+ 3.5. Required Notices.
+ You must duplicate the notice in Exhibit A in each file of the Source
+Code. If it is not possible to put such notice in a particular Source Code
+file due to its structure, then You must include such notice in a location
+(such as a relevant directory) where a user would be likely to look for such a
+notice. If You created one or more Modification(s) You may add your name as a
+Contributor to the notice described in Exhibit A. You must also duplicate
+this License in any documentation for the Source Code where You describe
+recipients' rights or ownership rights relating to Covered Code. You may
+choose to offer, and to charge a fee for, warranty, support, indemnity or
+liability obligations to one or more recipients of Covered Code. However, You
+may do so only on Your own behalf, and not on behalf of the Initial Developer
+or any Contributor. You must make it absolutely clear than any such warranty,
+support, indemnity or liability obligation is offered by You alone, and You
+hereby agree to indemnify the Initial Developer and every Contributor for any
+liability incurred by the Initial Developer or such Contributor as a result of
+warranty, support, indemnity or liability terms You offer.
+
+ 3.6. Distribution of Executable Versions.
+ You may distribute Covered Code in Executable form only if the
+requirements of Section 3.1-3.5 have been met for that Covered Code, and if
+You include a notice stating that the Source Code version of the Covered Code
+is available under the terms of this License, including a description of how
+and where You have fulfilled the obligations of Section 3.2. The notice must
+be conspicuously included in any notice in an Executable version, related
+documentation or collateral in which You describe recipients' rights relating
+to the Covered Code. You may distribute the Executable version of Covered Code
+or ownership rights under a license of Your choice, which may contain terms
+different from this License, provided that You are in compliance with the
+terms of this License and that the license for the Executable version does not
+attempt to limit or alter the recipient's rights in the Source Code version
+from the rights set forth in this License. If You distribute the Executable
+version under a different license You must make it absolutely clear that any
+terms which differ from this License are offered by You alone, not by the
+Initial Developer or any Contributor. You hereby agree to indemnify the
+Initial Developer and every Contributor for any liability incurred by the
+Initial Developer or such Contributor as a result of any such terms You offer.
+
+ 3.7. Larger Works.
+ You may create a Larger Work by combining Covered Code with other code
+not governed by the terms of this License and distribute the Larger Work as a
+single product. In such a case, You must make sure the requirements of this
+License are fulfilled for the Covered Code.
+
+4. Inability to Comply Due to Statute or Regulation.
+
+ If it is impossible for You to comply with any of the terms of this
+License with respect to some or all of the Covered Code due to statute,
+judicial order, or regulation then You must: (a) comply with the terms of this
+License to the maximum extent possible; and (b) describe the limitations and
+the code they affect. Such description must be included in the LEGAL file
+described in Section 3.4 and must be included with all distributions of the
+Source Code. Except to the extent prohibited by statute or regulation, such
+description must be sufficiently detailed for a recipient of ordinary skill to
+be able to understand it.
+
+5. Application of this License.
+
+ This License applies to code to which the Initial Developer has attached
+the notice in Exhibit A and to related Covered Code.
+
+6. Versions of the License.
+
+ 6.1. New Versions.
+ Netscape Communications Corporation ("Netscape") may publish revised
+and/or new versions of the License from time to time. Each version will be
+given a distinguishing version number.
+
+ 6.2. Effect of New Versions.
+ Once Covered Code has been published under a particular version of the
+License, You may always continue to use it under the terms of that version.
+You may also choose to use such Covered Code under the terms of any subsequent
+version of the License published by Netscape. No one other than Netscape has
+the right to modify the terms applicable to Covered Code created under this
+License.
+
+ 6.3. Derivative Works.
+ If You create or use a modified version of this License (which you may
+only do in order to apply it to code which is not already Covered Code
+governed by this License), You must (a) rename Your license so that the
+phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or
+any confusingly similar phrase do not appear in your license (except to note
+that your license differs from this License) and (b) otherwise make it clear
+that Your version of the license contains terms which differ from the Mozilla
+Public License and Netscape Public License. (Filling in the name of the
+Initial Developer, Original Code or Contributor in the notice described in
+Exhibit A shall not of themselves be deemed to be modifications of this
+License.)
+
+7. DISCLAIMER OF WARRANTY.
+
+ COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
+LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE,
+FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE
+QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED
+CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY
+OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR
+CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
+LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+DISCLAIMER.
+
+8. TERMINATION.
+
+ 8.1. This License and the rights granted hereunder will terminate
+automatically if You fail to comply with terms herein and fail to cure such
+breach within 30 days of becoming aware of the breach. All sublicenses to the
+Covered Code which are properly granted shall survive any termination of this
+License. Provisions which, by their nature, must remain in effect beyond the
+termination of this License shall survive.
+
+ 8.2. If You initiate litigation by asserting a patent infringement
+claim (excluding declatory judgment actions) against Initial Developer or a
+Contributor (the Initial Developer or Contributor against whom You file such
+action is referred to as "Participant") alleging that:
+
+ (a) such Participant's Contributor Version directly or indirectly
+infringes any patent, then any and all rights granted by such Participant to
+You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice
+from Participant terminate prospectively, unless if within 60 days after
+receipt of notice You either: (i) agree in writing to pay Participant a
+mutually agreeable reasonable royalty for Your past and future use of
+Modifications made by such Participant, or (ii) withdraw Your litigation claim
+with respect to the Contributor Version against such Participant. If within
+60 days of notice, a reasonable royalty and payment arrangement are not
+mutually agreed upon in writing by the parties or the litigation claim is not
+withdrawn, the rights granted by Participant to You under Sections 2.1 and/or
+2.2 automatically terminate at the expiration of the 60 day notice period
+specified above.
+
+ (b) any software, hardware, or device, other than such Participant's
+Contributor Version, directly or indirectly infringes any patent, then any
+rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are
+revoked effective as of the date You first made, used, sold, distributed, or
+had made, Modifications made by that Participant.
+
+ 8.3. If You assert a patent infringement claim against Participant
+alleging that such Participant's Contributor Version directly or indirectly
+infringes any patent where such claim is resolved (such as by license or
+settlement) prior to the initiation of patent infringement litigation, then
+the reasonable value of the licenses granted by such Participant under
+Sections 2.1 or 2.2 shall be taken into account in determining the amount or
+value of any payment or license.
+
+ 8.4. In the event of termination under Sections 8.1 or 8.2 above, all
+end user license agreements (excluding distributors and resellers) which have
+been validly granted by You or any distributor hereunder prior to termination
+shall survive termination.
+
+9. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
+DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY
+SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT,
+SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING,
+WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER
+FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES,
+EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH
+DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH
+OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
+EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS
+EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
+
+10. U.S. GOVERNMENT END USERS.
+
+ The Covered Code is a "commercial item," as that term is defined in 48
+C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and
+"commercial computer software documentation," as such terms are used in 48
+C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R.
+227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users
+acquire Covered Code with only those rights set forth herein.
+
+11. MISCELLANEOUS.
+
+ This License represents the complete agreement concerning subject matter
+hereof. If any provision of this License is held to be unenforceable, such
+provision shall be reformed only to the extent necessary to make it
+enforceable. This License shall be governed by California law provisions
+(except to the extent applicable law, if any, provides otherwise), excluding
+its conflict-of-law provisions. With respect to disputes in which at least one
+party is a citizen of, or an entity chartered or registered to do business in
+the United States of America, any litigation relating to this License shall be
+subject to the jurisdiction of the Federal Courts of the Northern District of
+California, with venue lying in Santa Clara County, California, with the
+losing party responsible for costs, including without limitation, court costs
+and reasonable attorneys' fees and expenses. The application of the United
+Nations Convention on Contracts for the International Sale of Goods is
+expressly excluded. Any law or regulation which provides that the language of
+a contract shall be construed against the drafter shall not apply to this
+License.
+
+12. RESPONSIBILITY FOR CLAIMS.
+
+ As between Initial Developer and the Contributors, each party is
+responsible for claims and damages arising, directly or indirectly, out of its
+utilization of rights under this License and You agree to work with Initial
+Developer and Contributors to distribute such responsibility on an equitable
+basis. Nothing herein is intended or shall be deemed to constitute any
+admission of liability.
+
+13. MULTIPLE-LICENSED CODE.
+
+ Initial Developer may designate portions of the Covered Code as
+Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits
+you to utilize portions of the Covered Code under Your choice of the MPL or
+the alternative licenses, if any, specified by the Initial Developer in the
+file described in Exhibit A.
+
+
+EXHIBIT A -Mozilla Public License.
+
+ ``The contents of this file are subject to the Mozilla Public License
+Version 1.1 (the "License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+ http://www.mozilla.org/MPL/
+
+ Software distributed under the License is distributed on an "AS IS"
+basis, WITHOUT WARRANTY OF
+ ANY KIND, either express or implied. See the License for the specific
+language governing rights and
+ limitations under the License.
+
+ The Original Code is ______________________________________.
+
+ The Initial Developer of the Original Code is ________________________.
+Portions created by
+ ______________________ are Copyright (C) ______
+_______________________. All Rights
+ Reserved.
+
+ Contributor(s): ______________________________________.
+
+ Alternatively, the contents of this file may be used under the terms of
+the _____ license (the [___] License), in which case the provisions of
+[______] License are applicable instead of those above. If you wish to allow
+use of your version of this file only under the terms of the [____] License
+and not to allow others to use your version of this file under the MPL,
+indicate your decision by deleting the provisions above and replace them
+with the notice and other provisions required by the [___] License. If you do
+not delete the provisions above, a recipient may use your version of this file
+under either the MPL or the [___] License."
+
+ [NOTE: The text of this Exhibit A may differ slightly from the text of
+the notices in the Source Code files of the Original Code. You should use the
+text of this Exhibit A rather than the text found in the Original Code Source
+Code for Your Modifications.]
+
+
+===============================================================================
+
+For the JAX-WS Reference Implementation component:
+
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
+
+
+ 1. Definitions.
+
+ 1.1. "Contributor" means each individual or entity that
+ creates or contributes to the creation of Modifications.
+
+ 1.2. "Contributor Version" means the combination of the
+ Original Software, prior Modifications used by a
+ Contributor (if any), and the Modifications made by that
+ particular Contributor.
+
+ 1.3. "Covered Software" means (a) the Original Software, or
+ (b) Modifications, or (c) the combination of files
+ containing Original Software with files containing
+ Modifications, in each case including portions thereof.
+
+ 1.4. "Executable" means the Covered Software in any form
+ other than Source Code.
+
+ 1.5. "Initial Developer" means the individual or entity
+ that first makes Original Software available under this
+ License.
+
+ 1.6. "Larger Work" means a work which combines Covered
+ Software or portions thereof with code not governed by the
+ terms of this License.
+
+ 1.7. "License" means this document.
+
+ 1.8. "Licensable" means having the right to grant, to the
+ maximum extent possible, whether at the time of the initial
+ grant or subsequently acquired, any and all of the rights
+ conveyed herein.
+
+ 1.9. "Modifications" means the Source Code and Executable
+ form of any of the following:
+
+ A. Any file that results from an addition to,
+ deletion from or modification of the contents of a
+ file containing Original Software or previous
+ Modifications;
+
+ B. Any new file that contains any part of the
+ Original Software or previous Modification; or
+
+ C. Any new file that is contributed or otherwise made
+ available under the terms of this License.
+
+ 1.10. "Original Software" means the Source Code and
+ Executable form of computer software code that is
+ originally released under this License.
+
+ 1.11. "Patent Claims" means any patent claim(s), now owned
+ or hereafter acquired, including without limitation,
+ method, process, and apparatus claims, in any patent
+ Licensable by grantor.
+
+ 1.12. "Source Code" means (a) the common form of computer
+ software code in which modifications are made and (b)
+ associated documentation included in or with such code.
+
+ 1.13. "You" (or "Your") means an individual or a legal
+ entity exercising rights under, and complying with all of
+ the terms of, this License. For legal entities, "You"
+ includes any entity which controls, is controlled by, or is
+ under common control with You. For purposes of this
+ definition, "control" means (a) the power, direct or
+ indirect, to cause the direction or management of such
+ entity, whether by contract or otherwise, or (b) ownership
+ of more than fifty percent (50%) of the outstanding shares
+ or beneficial ownership of such entity.
+
+ 2. License Grants.
+
+ 2.1. The Initial Developer Grant.
+
+ Conditioned upon Your compliance with Section 3.1 below and
+ subject to third party intellectual property claims, the
+ Initial Developer hereby grants You a world-wide,
+ royalty-free, non-exclusive license:
+
+ (a) under intellectual property rights (other than
+ patent or trademark) Licensable by Initial Developer,
+ to use, reproduce, modify, display, perform,
+ sublicense and distribute the Original Software (or
+ portions thereof), with or without Modifications,
+ and/or as part of a Larger Work; and
+
+ (b) under Patent Claims infringed by the making,
+ using or selling of Original Software, to make, have
+ made, use, practice, sell, and offer for sale, and/or
+ otherwise dispose of the Original Software (or
+ portions thereof).
+
+ (c) The licenses granted in Sections 2.1(a) and (b)
+ are effective on the date Initial Developer first
+ distributes or otherwise makes the Original Software
+ available to a third party under the terms of this
+ License.
+
+ (d) Notwithstanding Section 2.1(b) above, no patent
+ license is granted: (1) for code that You delete from
+ the Original Software, or (2) for infringements
+ caused by: (i) the modification of the Original
+ Software, or (ii) the combination of the Original
+ Software with other software or devices.
+
+ 2.2. Contributor Grant.
+
+ Conditioned upon Your compliance with Section 3.1 below and
+ subject to third party intellectual property claims, each
+ Contributor hereby grants You a world-wide, royalty-free,
+ non-exclusive license:
+
+ (a) under intellectual property rights (other than
+ patent or trademark) Licensable by Contributor to
+ use, reproduce, modify, display, perform, sublicense
+ and distribute the Modifications created by such
+ Contributor (or portions thereof), either on an
+ unmodified basis, with other Modifications, as
+ Covered Software and/or as part of a Larger Work; and
+
+
+ (b) under Patent Claims infringed by the making,
+ using, or selling of Modifications made by that
+ Contributor either alone and/or in combination with
+ its Contributor Version (or portions of such
+ combination), to make, use, sell, offer for sale,
+ have made, and/or otherwise dispose of: (1)
+ Modifications made by that Contributor (or portions
+ thereof); and (2) the combination of Modifications
+ made by that Contributor with its Contributor Version
+ (or portions of such combination).
+
+ (c) The licenses granted in Sections 2.2(a) and
+ 2.2(b) are effective on the date Contributor first
+ distributes or otherwise makes the Modifications
+ available to a third party.
+
+ (d) Notwithstanding Section 2.2(b) above, no patent
+ license is granted: (1) for any code that Contributor
+ has deleted from the Contributor Version; (2) for
+ infringements caused by: (i) third party
+ modifications of Contributor Version, or (ii) the
+ combination of Modifications made by that Contributor
+ with other software (except as part of the
+ Contributor Version) or other devices; or (3) under
+ Patent Claims infringed by Covered Software in the
+ absence of Modifications made by that Contributor.
+
+ 3. Distribution Obligations.
+
+ 3.1. Availability of Source Code.
+
+ Any Covered Software that You distribute or otherwise make
+ available in Executable form must also be made available in
+ Source Code form and that Source Code form must be
+ distributed only under the terms of this License. You must
+ include a copy of this License with every copy of the
+ Source Code form of the Covered Software You distribute or
+ otherwise make available. You must inform recipients of any
+ such Covered Software in Executable form as to how they can
+ obtain such Covered Software in Source Code form in a
+ reasonable manner on or through a medium customarily used
+ for software exchange.
+
+ 3.2. Modifications.
+
+ The Modifications that You create or to which You
+ contribute are governed by the terms of this License. You
+ represent that You believe Your Modifications are Your
+ original creation(s) and/or You have sufficient rights to
+ grant the rights conveyed by this License.
+
+ 3.3. Required Notices.
+
+ You must include a notice in each of Your Modifications
+ that identifies You as the Contributor of the Modification.
+ You may not remove or alter any copyright, patent or
+ trademark notices contained within the Covered Software, or
+ any notices of licensing or any descriptive text giving
+ attribution to any Contributor or the Initial Developer.
+
+ 3.4. Application of Additional Terms.
+
+ You may not offer or impose any terms on any Covered
+ Software in Source Code form that alters or restricts the
+ applicable version of this License or the recipients'
+ rights hereunder. You may choose to offer, and to charge a
+ fee for, warranty, support, indemnity or liability
+ obligations to one or more recipients of Covered Software.
+ However, you may do so only on Your own behalf, and not on
+ behalf of the Initial Developer or any Contributor. You
+ must make it absolutely clear that any such warranty,
+ support, indemnity or liability obligation is offered by
+ You alone, and You hereby agree to indemnify the Initial
+ Developer and every Contributor for any liability incurred
+ by the Initial Developer or such Contributor as a result of
+ warranty, support, indemnity or liability terms You offer.
+
+
+ 3.5. Distribution of Executable Versions.
+
+ You may distribute the Executable form of the Covered
+ Software under the terms of this License or under the terms
+ of a license of Your choice, which may contain terms
+ different from this License, provided that You are in
+ compliance with the terms of this License and that the
+ license for the Executable form does not attempt to limit
+ or alter the recipient's rights in the Source Code form
+ from the rights set forth in this License. If You
+ distribute the Covered Software in Executable form under a
+ different license, You must make it absolutely clear that
+ any terms which differ from this License are offered by You
+ alone, not by the Initial Developer or Contributor. You
+ hereby agree to indemnify the Initial Developer and every
+ Contributor for any liability incurred by the Initial
+ Developer or such Contributor as a result of any such terms
+ You offer.
+
+ 3.6. Larger Works.
+
+ You may create a Larger Work by combining Covered Software
+ with other code not governed by the terms of this License
+ and distribute the Larger Work as a single product. In such
+ a case, You must make sure the requirements of this License
+ are fulfilled for the Covered Software.
+
+ 4. Versions of the License.
+
+ 4.1. New Versions.
+
+ Sun Microsystems, Inc. is the initial license steward and
+ may publish revised and/or new versions of this License
+ from time to time. Each version will be given a
+ distinguishing version number. Except as provided in
+ Section 4.3, no one other than the license steward has the
+ right to modify this License.
+
+ 4.2. Effect of New Versions.
+
+ You may always continue to use, distribute or otherwise
+ make the Covered Software available under the terms of the
+ version of the License under which You originally received
+ the Covered Software. If the Initial Developer includes a
+ notice in the Original Software prohibiting it from being
+ distributed or otherwise made available under any
+ subsequent version of the License, You must distribute and
+ make the Covered Software available under the terms of the
+ version of the License under which You originally received
+ the Covered Software. Otherwise, You may also choose to
+ use, distribute or otherwise make the Covered Software
+ available under the terms of any subsequent version of the
+ License published by the license steward.
+
+ 4.3. Modified Versions.
+
+ When You are an Initial Developer and You want to create a
+ new license for Your Original Software, You may create and
+ use a modified version of this License if You: (a) rename
+ the license and remove any references to the name of the
+ license steward (except to note that the license differs
+ from this License); and (b) otherwise make it clear that
+ the license contains terms which differ from this License.
+
+
+ 5. DISCLAIMER OF WARRANTY.
+
+ COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
+ BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+ INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
+ SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
+ PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
+ PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
+ COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+ INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
+ ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
+ WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+ DISCLAIMER.
+
+ 6. TERMINATION.
+
+ 6.1. This License and the rights granted hereunder will
+ terminate automatically if You fail to comply with terms
+ herein and fail to cure such breach within 30 days of
+ becoming aware of the breach. Provisions which, by their
+ nature, must remain in effect beyond the termination of
+ this License shall survive.
+
+ 6.2. If You assert a patent infringement claim (excluding
+ declaratory judgment actions) against Initial Developer or
+ a Contributor (the Initial Developer or Contributor against
+ whom You assert such claim is referred to as "Participant")
+ alleging that the Participant Software (meaning the
+ Contributor Version where the Participant is a Contributor
+ or the Original Software where the Participant is the
+ Initial Developer) directly or indirectly infringes any
+ patent, then any and all rights granted directly or
+ indirectly to You by such Participant, the Initial
+ Developer (if the Initial Developer is not the Participant)
+ and all Contributors under Sections 2.1 and/or 2.2 of this
+ License shall, upon 60 days notice from Participant
+ terminate prospectively and automatically at the expiration
+ of such 60 day notice period, unless if within such 60 day
+ period You withdraw Your claim with respect to the
+ Participant Software against such Participant either
+ unilaterally or pursuant to a written agreement with
+ Participant.
+
+ 6.3. In the event of termination under Sections 6.1 or 6.2
+ above, all end user licenses that have been validly granted
+ by You or any distributor hereunder prior to termination
+ (excluding licenses granted to You by any distributor)
+ shall survive termination.
+
+ 7. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+ (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+ INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+ COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
+ LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+ CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+ LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK
+ STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+ COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+ INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+ LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+ INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+ APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
+ NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
+ CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
+ APPLY TO YOU.
+
+ 8. U.S. GOVERNMENT END USERS.
+
+ The Covered Software is a "commercial item," as that term is
+ defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
+ computer software" (as that term is defined at 48 C.F.R.
+ 252.227-7014(a)(1)) and "commercial computer software
+ documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
+ 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
+ through 227.7202-4 (June 1995), all U.S. Government End Users
+ acquire Covered Software with only those rights set forth herein.
+ This U.S. Government Rights clause is in lieu of, and supersedes,
+ any other FAR, DFAR, or other clause or provision that addresses
+ Government rights in computer software under this License.
+
+ 9. MISCELLANEOUS.
+
+ This License represents the complete agreement concerning subject
+ matter hereof. If any provision of this License is held to be
+ unenforceable, such provision shall be reformed only to the
+ extent necessary to make it enforceable. This License shall be
+ governed by the law of the jurisdiction specified in a notice
+ contained within the Original Software (except to the extent
+ applicable law, if any, provides otherwise), excluding such
+ jurisdiction's conflict-of-law provisions. Any litigation
+ relating to this License shall be subject to the jurisdiction of
+ the courts located in the jurisdiction and venue specified in a
+ notice contained within the Original Software, with the losing
+ party responsible for costs, including, without limitation, court
+ costs and reasonable attorneys' fees and expenses. The
+ application of the United Nations Convention on Contracts for the
+ International Sale of Goods is expressly excluded. Any law or
+ regulation which provides that the language of a contract shall
+ be construed against the drafter shall not apply to this License.
+ You agree that You alone are responsible for compliance with the
+ United States export administration regulations (and the export
+ control laws and regulation of any other countries) when You use,
+ distribute or otherwise make available any Covered Software.
+
+ 10. RESPONSIBILITY FOR CLAIMS.
+
+ As between Initial Developer and the Contributors, each party is
+ responsible for claims and damages arising, directly or
+ indirectly, out of its utilization of rights under this License
+ and You agree to work with Initial Developer and Contributors to
+ distribute such responsibility on an equitable basis. Nothing
+ herein is intended or shall be deemed to constitute any admission
+ of liability.
+
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/META-INF/MANIFEST.MF b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..cfdce9ed00
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Extension-Name: tuscany-das-rdb
+Specification-Title: Tuscany DAS for Relational Databases
+Specification-Vendor: Apache Software Foundation
+Implementation-Vendor: Apache Software Foundation
+Implementation-Vendor-Id: org.apache
+Implementation-Title: tuscany-das-rdb
+Implementation-Version: incubating-M1
+Bundle-ManifestVersion: 2
+Bundle-Name: Tuscany DAS for Relational Databases
+Bundle-SymbolicName: org.apache.tuscany.das.rdb
+Bundle-Version: 1.0.0
+Bundle-Vendor: Apache Software Foundation
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/META-INF/NOTICE b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000000..d48810c0ec
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,18 @@
+=========================================================================
+== NOTICE file corresponding to the section 4 d of ==
+== the Apache License, Version 2.0, ==
+== in this case for the Apache Tuscany distribution. ==
+=========================================================================
+
+This product includes software developed by the Apache Software Foundation
+(http://www.apache.org/).
+
+This product also includes software developed by:
+- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/)
+- the Celtix project (http://celtix.objectweb.org/)
+- the Mozilla Rhino project (http://www.mozilla.org/rhino/)
+- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/)
+
+Please read the LICENSE.txt file present in the root directory of this
+distribution.
+
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/META-INF/README.txt b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/META-INF/README.txt
new file mode 100644
index 0000000000..9b26d1690a
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/META-INF/README.txt
@@ -0,0 +1,35 @@
+Apache Tuscany M1 build (May, 2006)
+===================================
+
+http://incubator.apache.org/tuscany/
+
+Tuscany is an effort undergoing incubation at the Apache Software Foundation
+(ASF), sponsored by the Web Services PMC.
+
+Incubation is required of all newly accepted projects until a further review
+indicates that the infrastructure, communications, and decision making process
+have stabilized in a manner consistent with other successful ASF projects.
+
+While incubation status is not necessarily a reflection of the completeness or
+stability of the code, it does indicate that the project has yet to be fully
+endorsed by the ASF.
+
+
+Support
+-------
+
+Any problem with this release can be reported to the Tuscany mailing list
+or in the JIRA issue tracker.
+
+Mailing list subscription:
+ tuscany-dev-subscribe@ws.apache.org
+
+Jira:
+ http://issues.apache.org/jira/browse/Tuscany
+
+
+Thank you for using Tuscany!
+
+
+The Tuscany Team.
+
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/config.xsd b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/config.xsd
new file mode 100644
index 0000000000..726f573e79
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/config.xsd
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<xsd:schema
+ xmlns:config="http:///org.apache.tuscany.das.rdb/config.xsd"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http:///org.apache.tuscany.das.rdb/config.xsd">
+
+ <xsd:complexType name="Config">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" minOccurs="0" name="Command"
+ type="config:Command"/>
+ <xsd:element maxOccurs="unbounded" minOccurs="0" name="Table" type="config:Table"/>
+ <xsd:element maxOccurs="unbounded" minOccurs="0" name="Relationship"
+ type="config:Relationship"/>
+ <xsd:element maxOccurs="1" minOccurs="0" name="ConnectionInfo"
+ type="config:ConnectionInfo"/>
+ </xsd:sequence>
+ <xsd:attribute name="uri" type="xsd:string"/>
+ <xsd:attribute name="dataObjectModel" type="xsd:string"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="ConnectionInfo">
+ <xsd:attribute name="dataSource" type="xsd:string"/>
+ <xsd:attribute name="managedtx" type="xsd:boolean" default="true"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="Command">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" minOccurs="0" name="Parameter"
+ type="config:Parameter"/>
+ <xsd:element maxOccurs="unbounded" minOccurs="0" name="ResultDescriptor"
+ type="config:ResultDescriptor"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="SQL" type="xsd:string"/>
+ <xsd:attribute name="kind" type="xsd:string"/>
+ </xsd:complexType>
+ <xsd:complexType name="Parameter">
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="columnType" type="xsd:string"/>
+ <xsd:attribute name="direction" type="xsd:string"/>
+ </xsd:complexType>
+ <xsd:complexType name="Relationship">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" minOccurs="0" name="KeyPair"
+ type="config:KeyPair"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="primaryKeyTable" type="xsd:string"/>
+ <xsd:attribute name="foreignKeyTable" type="xsd:string"/>
+ <xsd:attribute name="many" type="xsd:boolean"/>
+ </xsd:complexType>
+ <xsd:complexType name="Table">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" minOccurs="0" name="Column"
+ type="config:Column"/>
+ <xsd:element maxOccurs="1" minOccurs="0" name="create" type="config:Create"/>
+ <xsd:element maxOccurs="1" minOccurs="0" name="update" type="config:Update"/>
+ <xsd:element maxOccurs="1" minOccurs="0" name="delete" type="config:Delete"/>
+ </xsd:sequence>
+ <xsd:attribute name="tableName" type="xsd:string"/>
+ <xsd:attribute name="typeName" type="xsd:string"/>
+ </xsd:complexType>
+ <xsd:complexType name="Create">
+ <xsd:attribute name="sql" type="xsd:string"/>
+ <xsd:attribute name="parameters" type="xsd:string"/>
+ </xsd:complexType>
+ <xsd:complexType name="Update">
+ <xsd:attribute name="sql" type="xsd:string"/>
+ <xsd:attribute name="parameters" type="xsd:string"/>
+ </xsd:complexType>
+ <xsd:complexType name="Delete">
+ <xsd:attribute name="sql" type="xsd:string"/>
+ <xsd:attribute name="parameters" type="xsd:string"/>
+ </xsd:complexType>
+ <xsd:complexType name="KeyPair">
+ <xsd:attribute name="primaryKeyColumn" type="xsd:string"/>
+ <xsd:attribute name="foreignKeyColumn" type="xsd:string"/>
+ </xsd:complexType>
+ <xsd:complexType name="Column">
+ <xsd:attribute name="columnName" type="xsd:string"/>
+ <xsd:attribute name="propertyName" type="xsd:string"/>
+ <xsd:attribute name="converterClassName" type="xsd:string"/>
+ <xsd:attribute name="primaryKey" type="xsd:boolean"/>
+ <xsd:attribute name="generated" type="xsd:boolean"/>
+ <xsd:attribute name="collision" type="xsd:boolean"/>
+ <xsd:attribute name="managed" type="xsd:boolean"/>
+ </xsd:complexType>
+ <xsd:complexType name="ResultDescriptor">
+ <xsd:attribute name="columnName" type="xsd:string"/>
+ <xsd:attribute name="tableName" type="xsd:string"/>
+ <xsd:attribute name="columnType" type="xsd:string"/>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/dasmodel4.mdl b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/dasmodel4.mdl
new file mode 100644
index 0000000000..476974975b
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/main/resources/dasmodel4.mdl
@@ -0,0 +1,4622 @@
+
+(object Petal
+ version 42
+ _written "Rose 4.5.8163.3"
+ charSet 0)
+
+(object Design "Logical View"
+ is_unit TRUE
+ is_loaded TRUE
+ defaults (object defaults
+ rightMargin 0.250000
+ leftMargin 0.250000
+ topMargin 0.250000
+ bottomMargin 0.500000
+ pageOverlap 0.250000
+ clipIconLabels TRUE
+ autoResize TRUE
+ snapToGrid TRUE
+ gridX 31
+ gridY 31
+ defaultFont (object Font
+ size 10
+ face "Arial"
+ bold FALSE
+ italics FALSE
+ underline FALSE
+ strike FALSE
+ color 0
+ default_color TRUE)
+ showMessageNum 3
+ showClassOfObject TRUE
+ notation "Unified")
+ root_usecase_package (object Class_Category "Use Case View"
+ quid "4362A29901BA"
+ exportControl "Public"
+ global TRUE
+ logical_models (list unit_reference_list)
+ logical_presentations (list unit_reference_list
+ (object UseCaseDiagram "Main"
+ quid "4362A2990259"
+ title "Main"
+ zoom 100
+ max_height 28350
+ max_width 21600
+ origin_x 0
+ origin_y 0
+ items (list diagram_item_list))))
+ root_category (object Class_Category "Logical View"
+ quid "4362A29901B9"
+ exportControl "Public"
+ global TRUE
+ subsystem "Component View"
+ quidu "4362A29901BB"
+ logical_models (list unit_reference_list
+ (object Class_Category "config"
+ attributes (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "nsURI"
+ value "http:///org.apache.tuscany.das.rdb/config.xsd")
+ (object Attribute
+ tool "Ecore"
+ name "basePackage"
+ value "org.apache.tuscany.das.rdb"))
+ quid "4362A2A10169"
+ exportControl "Public"
+ logical_models (list unit_reference_list
+ (object Class "Config"
+ quid "4362A2DE0045"
+ class_attributes (list class_attribute_list
+ (object ClassAttribute "uri"
+ quid "4362A337006B"
+ type "String")
+ (object ClassAttribute "dataSource"
+ quid "4485DF600233"
+ type "String")
+ (object ClassAttribute "dataObjectModel"
+ quid "449AB6CD0132"
+ type "String")))
+ (object Class "Command"
+ quid "4362A2EC01FE"
+ class_attributes (list class_attribute_list
+ (object ClassAttribute "name"
+ quid "4362A3EC02EC"
+ type "String")
+ (object ClassAttribute "SQL"
+ quid "4362A3EF0246"
+ type "String")
+ (object ClassAttribute "kind"
+ quid "437903E60321"
+ type "String")))
+ (object Class "Parameter"
+ quid "4362A3C902BA"
+ class_attributes (list class_attribute_list
+ (object ClassAttribute "name"
+ quid "4362A40600D7"
+ type "String")
+ (object ClassAttribute "columnType"
+ quid "4362A4090280"
+ type "String")))
+ (object Class "Relationship"
+ quid "4362A42E03A5"
+ class_attributes (list class_attribute_list
+ (object ClassAttribute "name"
+ quid "4362A73A0216"
+ type "String")
+ (object ClassAttribute "primaryKeyTable"
+ quid "4362A73D0329"
+ type "String")
+ (object ClassAttribute "foreignKeyTable"
+ quid "4362A74002FB"
+ type "String")
+ (object ClassAttribute "many"
+ quid "4362A7430241"
+ type "boolean")))
+ (object Class "Table"
+ quid "4362A43C0002"
+ class_attributes (list class_attribute_list
+ (object ClassAttribute "tableName"
+ quid "4362A7B2031D"
+ type "String")
+ (object ClassAttribute "typeName"
+ quid "4362A7C203A2"
+ type "String")
+ (object ClassAttribute "create"
+ quid "4362A7D0024E"
+ type "String")
+ (object ClassAttribute "update"
+ quid "4362A7D30220"
+ type "String")
+ (object ClassAttribute "delete"
+ quid "4362A7E1031B"
+ type "String")))
+ (object Class "KeyPair"
+ quid "4362A72E0010"
+ class_attributes (list class_attribute_list
+ (object ClassAttribute "primaryKeyColumn"
+ quid "4362A8E702A9"
+ type "String")
+ (object ClassAttribute "foreignKeyColumn"
+ quid "4362A8ED01AE"
+ type "String")))
+ (object Class "Column"
+ quid "4362A75C016B"
+ class_attributes (list class_attribute_list
+ (object ClassAttribute "columnName"
+ quid "4362A8BD02E5"
+ type "String")
+ (object ClassAttribute "propertyName"
+ quid "4362A8C001C7"
+ type "String")
+ (object ClassAttribute "converterClassName"
+ quid "4362A8C303A2"
+ type "String")
+ (object ClassAttribute "columnType"
+ quid "4362A8C903A0"
+ type "String")
+ (object ClassAttribute "primaryKey"
+ quid "437907F200F9"
+ type "boolean")
+ (object ClassAttribute "generated"
+ quid "4379083900BF"
+ type "boolean")
+ (object ClassAttribute "collision"
+ quid "437908E5012B"
+ type "boolean")))
+ (object Class "ResultDescriptor"
+ quid "437B57EF0008"
+ class_attributes (list class_attribute_list
+ (object ClassAttribute "columnName"
+ quid "437B5A6503BB"
+ type "String")
+ (object ClassAttribute "tableName"
+ quid "437B5A6B016B"
+ type "String")
+ (object ClassAttribute "columnType"
+ quid "437B5A6D033A"
+ type "String")
+ (object ClassAttribute "name"
+ quid "449AB74D03DF"
+ type "type"
+ initv "initval"))
+ language "Java")
+ (object Association "$UNNAMED$0"
+ quid "4362A3030323"
+ roles (list role_list
+ (object Role "$UNNAMED$1"
+ quid "4362A3040108"
+ supplier "Logical View::config::Config"
+ quidu "4362A2DE0045"
+ is_navigable TRUE
+ is_aggregate TRUE)
+ (object Role "$UNNAMED$2"
+ quid "4362A3040109"
+ supplier "Logical View::config::Command"
+ quidu "4362A2EC01FE"
+ client_cardinality (value cardinality "0..n")
+ Containment "By Value"
+ is_navigable TRUE)))
+ (object Association "$UNNAMED$3"
+ quid "4362A3D302FA"
+ roles (list role_list
+ (object Role "$UNNAMED$4"
+ quid "4362A3D40143"
+ supplier "Logical View::config::Command"
+ quidu "4362A2EC01FE"
+ is_navigable TRUE
+ is_aggregate TRUE)
+ (object Role "$UNNAMED$5"
+ quid "4362A3D40144"
+ supplier "Logical View::config::Parameter"
+ quidu "4362A3C902BA"
+ client_cardinality (value cardinality "0..n")
+ Containment "By Value"
+ is_navigable TRUE)))
+ (object Association "$UNNAMED$6"
+ quid "4362A448026C"
+ roles (list role_list
+ (object Role "$UNNAMED$7"
+ quid "4362A4490105"
+ supplier "Logical View::config::Config"
+ quidu "4362A2DE0045"
+ is_navigable TRUE
+ is_aggregate TRUE)
+ (object Role "$UNNAMED$8"
+ quid "4362A4490106"
+ supplier "Logical View::config::Table"
+ quidu "4362A43C0002"
+ client_cardinality (value cardinality "0..n")
+ Containment "By Value"
+ is_navigable TRUE)))
+ (object Association "$UNNAMED$9"
+ quid "4362A44B0298"
+ roles (list role_list
+ (object Role "$UNNAMED$10"
+ quid "4362A44C01AA"
+ supplier "Logical View::config::Config"
+ quidu "4362A2DE0045"
+ is_navigable TRUE
+ is_aggregate TRUE)
+ (object Role "$UNNAMED$11"
+ quid "4362A44C01AB"
+ supplier "Logical View::config::Relationship"
+ quidu "4362A42E03A5"
+ client_cardinality (value cardinality "0..n")
+ Containment "By Value"
+ is_navigable TRUE)))
+ (object Association "$UNNAMED$12"
+ quid "4362A76302A1"
+ roles (list role_list
+ (object Role "$UNNAMED$13"
+ quid "4362A7640090"
+ supplier "Logical View::config::Table"
+ quidu "4362A43C0002"
+ is_navigable TRUE
+ is_aggregate TRUE)
+ (object Role "$UNNAMED$14"
+ quid "4362A7640091"
+ supplier "Logical View::config::Column"
+ quidu "4362A75C016B"
+ client_cardinality (value cardinality "0..n")
+ Containment "By Value"
+ is_navigable TRUE)))
+ (object Association "$UNNAMED$15"
+ quid "4362A771032E"
+ roles (list role_list
+ (object Role "$UNNAMED$16"
+ quid "4362A7720108"
+ supplier "Logical View::config::Relationship"
+ quidu "4362A42E03A5"
+ is_navigable TRUE
+ is_aggregate TRUE)
+ (object Role "$UNNAMED$17"
+ quid "4362A7720109"
+ supplier "Logical View::config::KeyPair"
+ quidu "4362A72E0010"
+ client_cardinality (value cardinality "0..n")
+ Containment "By Value"
+ is_navigable TRUE)))
+ (object Association "$UNNAMED$18"
+ quid "437B59A10066"
+ roles (list role_list
+ (object Role "$UNNAMED$19"
+ quid "437B59A30145"
+ supplier "Logical View::config::Command"
+ quidu "4362A2EC01FE"
+ Containment "By Value"
+ is_navigable TRUE
+ is_aggregate TRUE)
+ (object Role "$UNNAMED$20"
+ quid "437B59A30146"
+ supplier "Logical View::config::ResultDescriptor"
+ quidu "437B57EF0008"
+ client_cardinality (value cardinality "0..n")
+ Containment "By Value"
+ is_navigable TRUE))))
+ logical_presentations (list unit_reference_list
+ (object ClassDiagram "Main"
+ quid "4362A2A900AD"
+ title "Main"
+ zoom 100
+ max_height 28350
+ max_width 21600
+ origin_x 0
+ origin_y 0
+ items (list diagram_item_list
+ (object ClassView "Class" "Logical View::config::KeyPair" @1
+ ShowCompartmentStereotypes TRUE
+ IncludeAttribute TRUE
+ IncludeOperation TRUE
+ location (1054, 1333)
+ label (object ItemLabel
+ Parent_View @1
+ location (809, 1227)
+ fill_color 13434879
+ nlines 1
+ max_width 490
+ justify 0
+ label "KeyPair")
+ icon_style "Icon"
+ line_color 3342489
+ fill_color 13434879
+ quidu "4362A72E0010"
+ compartment (object Compartment
+ Parent_View @1
+ location (809, 1287)
+ icon_style "Icon"
+ fill_color 16777215
+ anchor 2
+ nlines 3
+ max_width 496)
+ width 508
+ height 236
+ autoResize TRUE)
+ (object ClassView "Class" "Logical View::config::Column" @2
+ ShowCompartmentStereotypes TRUE
+ IncludeAttribute TRUE
+ IncludeOperation TRUE
+ location (2015, 1519)
+ label (object ItemLabel
+ Parent_View @2
+ location (1756, 1288)
+ fill_color 13434879
+ nlines 1
+ max_width 518
+ justify 0
+ label "Column")
+ icon_style "Icon"
+ line_color 3342489
+ fill_color 13434879
+ quidu "4362A75C016B"
+ compartment (object Compartment
+ Parent_View @2
+ location (1756, 1348)
+ icon_style "Icon"
+ fill_color 16777215
+ anchor 2
+ nlines 8
+ max_width 525)
+ width 536
+ height 486
+ autoResize TRUE)
+ (object ClassView "Class" "Logical View::config::Relationship" @3
+ ShowCompartmentStereotypes TRUE
+ IncludeAttribute TRUE
+ IncludeOperation TRUE
+ location (1054, 744)
+ label (object ItemLabel
+ Parent_View @3
+ location (829, 588)
+ fill_color 13434879
+ nlines 1
+ max_width 450
+ justify 0
+ label "Relationship")
+ icon_style "Icon"
+ line_color 3342489
+ fill_color 13434879
+ quidu "4362A42E03A5"
+ compartment (object Compartment
+ Parent_View @3
+ location (829, 648)
+ icon_style "Icon"
+ fill_color 16777215
+ anchor 2
+ nlines 5
+ max_width 456)
+ width 468
+ height 336
+ autoResize TRUE)
+ (object AssociationViewNew "$UNNAMED$15" @4
+ location (1081, 1063)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A771032E"
+ roleview_list (list RoleViews
+ (object RoleView "$UNNAMED$16" @5
+ Parent_View @4
+ location (-97, -84)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A7720108"
+ client @4
+ supplier @3
+ line_style 3
+ origin_attachment (1080, 1063)
+ terminal_attachment (1080, 912))
+ (object RoleView "$UNNAMED$17" @6
+ Parent_View @4
+ location (-97, -84)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A7720109"
+ client @4
+ supplier @1
+ line_style 3
+ origin_attachment (1080, 1063)
+ terminal_attachment (1080, 1215)
+ label (object SegLabel @7
+ Parent_View @6
+ location (1135, 1112)
+ anchor 2
+ anchor_loc 1
+ nlines 1
+ max_width 15
+ justify 0
+ label "0..*"
+ pctDist 0.327273
+ height 55
+ orientation 0))))
+ (object ClassView "Class" "Logical View::config::Table" @8
+ ShowCompartmentStereotypes TRUE
+ IncludeAttribute TRUE
+ IncludeOperation TRUE
+ location (1984, 837)
+ label (object ItemLabel
+ Parent_View @8
+ location (1814, 656)
+ fill_color 13434879
+ nlines 1
+ max_width 340
+ justify 0
+ label "Table")
+ icon_style "Icon"
+ line_color 3342489
+ fill_color 13434879
+ quidu "4362A43C0002"
+ compartment (object Compartment
+ Parent_View @8
+ location (1814, 716)
+ icon_style "Icon"
+ fill_color 16777215
+ anchor 2
+ nlines 6
+ max_width 346)
+ width 358
+ height 386
+ autoResize TRUE)
+ (object AssociationViewNew "$UNNAMED$12" @9
+ location (1807, 1153)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A76302A1"
+ roleview_list (list RoleViews
+ (object RoleView "$UNNAMED$13" @10
+ Parent_View @9
+ location (1032, 6)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A7640090"
+ client @9
+ supplier @8
+ line_style 3
+ origin_attachment (1807, 1153)
+ terminal_attachment (1807, 1030))
+ (object RoleView "$UNNAMED$14" @11
+ Parent_View @9
+ location (1032, 6)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A7640091"
+ client @9
+ supplier @2
+ line_style 3
+ origin_attachment (1807, 1153)
+ terminal_attachment (1807, 1276)
+ label (object SegLabel @12
+ Parent_View @11
+ location (1861, 1166)
+ anchor 2
+ anchor_loc 1
+ nlines 1
+ max_width 15
+ justify 0
+ label "0..*"
+ pctDist 0.109091
+ height 54
+ orientation 0))))
+ (object ClassView "Class" "Logical View::config::Parameter" @13
+ ShowCompartmentStereotypes TRUE
+ IncludeAttribute TRUE
+ IncludeOperation TRUE
+ location (186, 806)
+ label (object ItemLabel
+ Parent_View @13
+ location (4, 700)
+ fill_color 13434879
+ nlines 1
+ max_width 364
+ justify 0
+ label "Parameter")
+ icon_style "Icon"
+ line_color 3342489
+ fill_color 13434879
+ quidu "4362A3C902BA"
+ compartment (object Compartment
+ Parent_View @13
+ location (4, 760)
+ icon_style "Icon"
+ fill_color 16777215
+ anchor 2
+ nlines 3
+ max_width 371)
+ width 382
+ height 236
+ autoResize TRUE)
+ (object ClassView "Class" "Logical View::config::Config" @14
+ ShowCompartmentStereotypes TRUE
+ IncludeAttribute TRUE
+ IncludeOperation TRUE
+ location (1054, 186)
+ label (object ItemLabel
+ Parent_View @14
+ location (828, 55)
+ fill_color 13434879
+ nlines 1
+ max_width 452
+ justify 0
+ label "Config")
+ icon_style "Icon"
+ line_color 3342489
+ fill_color 13434879
+ quidu "4362A2DE0045"
+ compartment (object Compartment
+ Parent_View @14
+ location (828, 115)
+ icon_style "Icon"
+ fill_color 16777215
+ anchor 2
+ nlines 4
+ max_width 450)
+ width 470
+ height 286
+ autoResize TRUE)
+ (object AssociationViewNew "$UNNAMED$9" @15
+ location (1054, 452)
+ label (object SegLabel @16
+ Parent_View @15
+ location (1054, 393)
+ font (object Font
+ italics TRUE)
+ hidden TRUE
+ anchor 1
+ anchor_loc 1
+ nlines 1
+ max_width 600
+ justify 0
+ label ""
+ pctDist 0.500000
+ height 60
+ orientation 0)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A44B0298"
+ roleview_list (list RoleViews
+ (object RoleView "$UNNAMED$10" @17
+ Parent_View @15
+ location (-93, -354)
+ label (object SegLabel @18
+ Parent_View @17
+ location (1013, 354)
+ hidden TRUE
+ anchor 1
+ anchor_loc 1
+ nlines 1
+ max_width 252
+ justify 0
+ label ""
+ pctDist 0.800000
+ height 42
+ orientation 0)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A44C01AA"
+ client @15
+ supplier @14
+ line_style 0)
+ (object RoleView "$UNNAMED$11" @19
+ Parent_View @15
+ location (-93, -354)
+ label (object SegLabel @20
+ Parent_View @19
+ location (1013, 526)
+ hidden TRUE
+ anchor 1
+ anchor_loc 1
+ nlines 1
+ max_width 252
+ justify 0
+ label ""
+ pctDist 0.597561
+ height 42
+ orientation 1)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A44C01AB"
+ client @15
+ supplier @3
+ line_style 0
+ label (object SegLabel @21
+ Parent_View @19
+ location (1011, 562)
+ anchor 2
+ anchor_loc 1
+ nlines 1
+ max_width 15
+ justify 0
+ label "0..*"
+ pctDist 0.899471
+ height 44
+ orientation 1))))
+ (object AssociationViewNew "$UNNAMED$6" @22
+ location (1829, 247)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A448026C"
+ roleview_list (list RoleViews
+ (object RoleView "$UNNAMED$7" @23
+ Parent_View @22
+ location (1023, -559)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A4490105"
+ client @22
+ supplier @14
+ line_style 3
+ origin_attachment (1829, 247)
+ terminal_attachment (1289, 247))
+ (object RoleView "$UNNAMED$8" @24
+ Parent_View @22
+ location (1023, -559)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A4490106"
+ client @22
+ supplier @8
+ vertices (list Points
+ (1829, 247)
+ (1972, 247)
+ (1972, 644))
+ line_style 3
+ origin_attachment (1829, 247)
+ terminal_attachment (1972, 644)
+ label (object SegLabel @25
+ Parent_View @24
+ location (2031, 441)
+ anchor 2
+ anchor_loc 1
+ nlines 1
+ max_width 15
+ justify 0
+ label "0..*"
+ pctDist 0.625538
+ height 59
+ orientation 0))))
+ (object ClassView "Class" "Logical View::config::Command" @26
+ ShowCompartmentStereotypes TRUE
+ IncludeAttribute TRUE
+ IncludeOperation TRUE
+ location (186, 217)
+ label (object ItemLabel
+ Parent_View @26
+ location (63, 86)
+ fill_color 13434879
+ nlines 1
+ max_width 246
+ justify 0
+ label "Command")
+ icon_style "Icon"
+ line_color 3342489
+ fill_color 13434879
+ quidu "4362A2EC01FE"
+ compartment (object Compartment
+ Parent_View @26
+ location (63, 146)
+ icon_style "Icon"
+ fill_color 16777215
+ anchor 2
+ nlines 4
+ max_width 253)
+ width 264
+ height 286
+ autoResize TRUE)
+ (object AssociationViewNew "$UNNAMED$3" @27
+ location (186, 523)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A3D302FA"
+ roleview_list (list RoleViews
+ (object RoleView "$UNNAMED$4" @28
+ Parent_View @27
+ location (-279, -500)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A3D40143"
+ client @27
+ supplier @26
+ line_style 0)
+ (object RoleView "$UNNAMED$5" @29
+ Parent_View @27
+ location (-279, -500)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A3D40144"
+ client @27
+ supplier @13
+ line_style 0
+ label (object SegLabel @30
+ Parent_View @29
+ location (241, 600)
+ anchor 2
+ anchor_loc 1
+ nlines 1
+ max_width 15
+ justify 0
+ label "0..*"
+ pctDist 0.473684
+ height 55
+ orientation 0))))
+ (object AssociationViewNew "$UNNAMED$0" @31
+ location (568, 213)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A3030323"
+ roleview_list (list RoleViews
+ (object RoleView "$UNNAMED$1" @32
+ Parent_View @31
+ location (134, -469)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A3040108"
+ client @31
+ supplier @14
+ line_style 3
+ origin_attachment (568, 213)
+ terminal_attachment (819, 213))
+ (object RoleView "$UNNAMED$2" @33
+ Parent_View @31
+ location (134, -469)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A3040109"
+ client @31
+ supplier @26
+ line_style 3
+ origin_attachment (568, 213)
+ terminal_attachment (318, 213)
+ label (object SegLabel @34
+ Parent_View @33
+ location (360, 261)
+ anchor 2
+ anchor_loc 1
+ nlines 1
+ max_width 15
+ justify 0
+ label "0..*"
+ pctDist 0.831858
+ height 48
+ orientation 0))))
+ (object ClassView "Class" "Logical View::config::ResultDescriptor" @35
+ ShowCompartmentStereotypes TRUE
+ IncludeAttribute TRUE
+ IncludeOperation TRUE
+ location (465, 1240)
+ label (object ItemLabel
+ Parent_View @35
+ location (248, 1084)
+ fill_color 13434879
+ nlines 1
+ max_width 434
+ justify 0
+ label "ResultDescriptor")
+ icon_style "Icon"
+ line_color 3342489
+ fill_color 13434879
+ quidu "437B57EF0008"
+ compartment (object Compartment
+ Parent_View @35
+ location (248, 1144)
+ icon_style "Icon"
+ fill_color 16777215
+ anchor 2
+ nlines 5
+ max_width 431)
+ width 452
+ height 336
+ annotation 8
+ autoResize TRUE)
+ (object AssociationViewNew "$UNNAMED$18" @36
+ location (484, 626)
+ stereotype TRUE
+ line_color 3342489
+ quidu "437B59A10066"
+ roleview_list (list RoleViews
+ (object RoleView "$UNNAMED$19" @37
+ Parent_View @36
+ location (50, -614)
+ stereotype TRUE
+ line_color 3342489
+ quidu "437B59A30145"
+ client @36
+ supplier @26
+ vertices (list Points
+ (484, 626)
+ (484, 347)
+ (318, 347))
+ line_style 3
+ origin_attachment (484, 626)
+ terminal_attachment (318, 347))
+ (object RoleView "$UNNAMED$20" @38
+ Parent_View @36
+ location (50, -614)
+ stereotype TRUE
+ line_color 3342489
+ quidu "437B59A30146"
+ client @36
+ supplier @35
+ line_style 3
+ origin_attachment (484, 626)
+ terminal_attachment (484, 1072)
+ label (object SegLabel @39
+ Parent_View @38
+ location (538, 1027)
+ anchor 2
+ anchor_loc 1
+ nlines 1
+ max_width 15
+ justify 0
+ label "0..*"
+ pctDist 0.900000
+ height 54
+ orientation 0)))))))))
+ logical_presentations (list unit_reference_list
+ (object ClassDiagram "Main"
+ quid "4362A299025A"
+ title "Main"
+ zoom 100
+ max_height 28350
+ max_width 21600
+ origin_x 0
+ origin_y 0
+ items (list diagram_item_list
+ (object CategoryView "Logical View::config" @40
+ location (682, 589)
+ label (object ItemLabel
+ Parent_View @40
+ location (538, 505)
+ fill_color 13434879
+ nlines 2
+ max_width 288
+ justify 0
+ label "config")
+ icon_style "Icon"
+ line_color 3342489
+ fill_color 13434879
+ quidu "4362A2A10169"
+ width 300
+ height 180)))))
+ root_subsystem (object SubSystem "Component View"
+ quid "4362A29901BB"
+ physical_models (list unit_reference_list)
+ physical_presentations (list unit_reference_list
+ (object Module_Diagram "Main"
+ quid "4362A2990258"
+ title "Main"
+ zoom 100
+ max_height 28350
+ max_width 21600
+ origin_x 0
+ origin_y 0
+ items (list diagram_item_list))))
+ process_structure (object Processes
+ quid "4362A29901BC"
+ ProcsNDevs (list
+ (object Process_Diagram "Deployment View"
+ quid "4362A29901BE"
+ title "Deployment View"
+ zoom 100
+ max_height 28350
+ max_width 21600
+ origin_x 0
+ origin_y 0
+ items (list diagram_item_list))))
+ properties (object Properties
+ attributes (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "propertyId"
+ value "809135969")
+ (object Attribute
+ tool "Ecore"
+ name "default__Category"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "packageName"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "nsPrefix"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "nsURI"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "basePackage"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "prefix"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "annotation"
+ value "")))
+ (object Attribute
+ tool "Ecore"
+ name "default__Class"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "classifierName"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "constraints"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "xmlName"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "xmlContentKind"
+ value ("ContentKind" 0))
+ (object Attribute
+ tool "Ecore"
+ name "ContentKind"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "Unspecified"
+ value 0)
+ (object Attribute
+ tool "Ecore"
+ name "Empty"
+ value 1)
+ (object Attribute
+ tool "Ecore"
+ name "Simple"
+ value 2)
+ (object Attribute
+ tool "Ecore"
+ name "Mixed"
+ value 3)
+ (object Attribute
+ tool "Ecore"
+ name "ElementOnly"
+ value 4)))
+ (object Attribute
+ tool "Ecore"
+ name "annotation"
+ value "")))
+ (object Attribute
+ tool "Ecore"
+ name "default__Operation"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "operationName"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "isUnique"
+ value TRUE)
+ (object Attribute
+ tool "Ecore"
+ name "annotation"
+ value "")))
+ (object Attribute
+ tool "Ecore"
+ name "default__Attribute"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "attributeName"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "isTransient"
+ value FALSE)
+ (object Attribute
+ tool "Ecore"
+ name "isVolatile"
+ value FALSE)
+ (object Attribute
+ tool "Ecore"
+ name "isChangeable"
+ value TRUE)
+ (object Attribute
+ tool "Ecore"
+ name "isUnsettable"
+ value FALSE)
+ (object Attribute
+ tool "Ecore"
+ name "isUnique"
+ value TRUE)
+ (object Attribute
+ tool "Ecore"
+ name "isID"
+ value FALSE)
+ (object Attribute
+ tool "Ecore"
+ name "visibility"
+ value ("VisibilityKind" 0))
+ (object Attribute
+ tool "Ecore"
+ name "VisibilityKind"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "Unspecified"
+ value 0)
+ (object Attribute
+ tool "Ecore"
+ name "None"
+ value 1)
+ (object Attribute
+ tool "Ecore"
+ name "Read-only"
+ value 2)
+ (object Attribute
+ tool "Ecore"
+ name "Read-write"
+ value 3)
+ (object Attribute
+ tool "Ecore"
+ name "Read-only unsettable"
+ value 4)
+ (object Attribute
+ tool "Ecore"
+ name "Read-write unsettable"
+ value 5)))
+ (object Attribute
+ tool "Ecore"
+ name "xmlName"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "xmlNamespace"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "xmlFeatureKind"
+ value ("FeatureKind" 0))
+ (object Attribute
+ tool "Ecore"
+ name "FeatureKind"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "Unspecified"
+ value 0)
+ (object Attribute
+ tool "Ecore"
+ name "Simple"
+ value 1)
+ (object Attribute
+ tool "Ecore"
+ name "Attribute"
+ value 2)
+ (object Attribute
+ tool "Ecore"
+ name "Element"
+ value 4)))
+ (object Attribute
+ tool "Ecore"
+ name "annotation"
+ value "")))
+ (object Attribute
+ tool "Ecore"
+ name "default__Role"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "referenceName"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "isTransient"
+ value FALSE)
+ (object Attribute
+ tool "Ecore"
+ name "isVolatile"
+ value FALSE)
+ (object Attribute
+ tool "Ecore"
+ name "isChangeable"
+ value TRUE)
+ (object Attribute
+ tool "Ecore"
+ name "isUnsettable"
+ value FALSE)
+ (object Attribute
+ tool "Ecore"
+ name "isResolveProxies"
+ value TRUE)
+ (object Attribute
+ tool "Ecore"
+ name "visibility"
+ value ("VisibilityKind" 0))
+ (object Attribute
+ tool "Ecore"
+ name "VisibilityKind"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "Unspecified"
+ value 0)
+ (object Attribute
+ tool "Ecore"
+ name "None"
+ value 1)
+ (object Attribute
+ tool "Ecore"
+ name "Read-only"
+ value 2)
+ (object Attribute
+ tool "Ecore"
+ name "Read-write"
+ value 3)
+ (object Attribute
+ tool "Ecore"
+ name "Read-only unsettable"
+ value 4)
+ (object Attribute
+ tool "Ecore"
+ name "Read-write unsettable"
+ value 5)))
+ (object Attribute
+ tool "Ecore"
+ name "xmlName"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "xmlNamespace"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "xmlFeatureKind"
+ value ("FeatureKind" 0))
+ (object Attribute
+ tool "Ecore"
+ name "FeatureKind"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "Unspecified"
+ value 0)
+ (object Attribute
+ tool "Ecore"
+ name "Simple"
+ value 1)
+ (object Attribute
+ tool "Ecore"
+ name "Attribute"
+ value 2)
+ (object Attribute
+ tool "Ecore"
+ name "Element"
+ value 4)))
+ (object Attribute
+ tool "Ecore"
+ name "annotation"
+ value "")))
+ (object Attribute
+ tool "DDL"
+ name "propertyId"
+ value "809135966")
+ (object Attribute
+ tool "DDL"
+ name "default__Project"
+ value (list Attribute_Set
+ (object Attribute
+ tool "DDL"
+ name "Directory"
+ value "AUTO GENERATE")
+ (object Attribute
+ tool "DDL"
+ name "DataBase"
+ value ("DataBaseSet" 800))
+ (object Attribute
+ tool "DDL"
+ name "DataBaseSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "DDL"
+ name "ANSI"
+ value 800)
+ (object Attribute
+ tool "DDL"
+ name "Oracle"
+ value 801)
+ (object Attribute
+ tool "DDL"
+ name "SQLServer"
+ value 802)
+ (object Attribute
+ tool "DDL"
+ name "Sybase"
+ value 803)
+ (object Attribute
+ tool "DDL"
+ name "Watcom"
+ value 804)))
+ (object Attribute
+ tool "DDL"
+ name "PrimaryKeyColumnName"
+ value "Id")
+ (object Attribute
+ tool "DDL"
+ name "PrimaryKeyColumnType"
+ value "NUMBER(5)")
+ (object Attribute
+ tool "DDL"
+ name "ViewName"
+ value "V_")
+ (object Attribute
+ tool "DDL"
+ name "TableName"
+ value "T_")
+ (object Attribute
+ tool "DDL"
+ name "InheritSuffix"
+ value "_V")
+ (object Attribute
+ tool "DDL"
+ name "DropClause"
+ value FALSE)
+ (object Attribute
+ tool "DDL"
+ name "BaseViews"
+ value FALSE)
+ (object Attribute
+ tool "DDL"
+ name "DDLScriptFilename"
+ value "DDL1.SQL")))
+ (object Attribute
+ tool "DDL"
+ name "default__Attribute"
+ value (list Attribute_Set
+ (object Attribute
+ tool "DDL"
+ name "ColumnType"
+ value "VARCHAR")
+ (object Attribute
+ tool "DDL"
+ name "Length"
+ value "")
+ (object Attribute
+ tool "DDL"
+ name "NullsOK"
+ value TRUE)
+ (object Attribute
+ tool "DDL"
+ name "PrimaryKey"
+ value FALSE)
+ (object Attribute
+ tool "DDL"
+ name "Unique"
+ value FALSE)
+ (object Attribute
+ tool "DDL"
+ name "CompositeUnique"
+ value FALSE)
+ (object Attribute
+ tool "DDL"
+ name "CheckConstraint"
+ value "")))
+ (object Attribute
+ tool "DDL"
+ name "HiddenTool"
+ value FALSE)
+ (object Attribute
+ tool "framework"
+ name "HiddenTool"
+ value FALSE)
+ (object Attribute
+ tool "IDL"
+ name "propertyId"
+ value "809135966")
+ (object Attribute
+ tool "IDL"
+ name "default__Project"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "CreateMissingDirectories"
+ value TRUE)
+ (object Attribute
+ tool "IDL"
+ name "StopOnError"
+ value TRUE)
+ (object Attribute
+ tool "IDL"
+ name "Directory"
+ value "AUTO GENERATE")
+ (object Attribute
+ tool "IDL"
+ name "GeneratePreserveRegions"
+ value TRUE)))
+ (object Attribute
+ tool "IDL"
+ name "default__Class"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "ImplementationType"
+ value "")
+ (object Attribute
+ tool "IDL"
+ name "ConstValue"
+ value "")
+ (object Attribute
+ tool "IDL"
+ name "GenerateDefaultSpecifier"
+ value FALSE)
+ (object Attribute
+ tool "IDL"
+ name "DefaultSpecifier"
+ value "")
+ (object Attribute
+ tool "IDL"
+ name "IDLElement"
+ value TRUE)
+ (object Attribute
+ tool "IDL"
+ name "IDLSpecificationType"
+ value ("IDLSpecSet" 22))
+ (object Attribute
+ tool "IDL"
+ name "IDLSpecSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "Interface"
+ value 22)
+ (object Attribute
+ tool "IDL"
+ name "Typedef"
+ value 54)
+ (object Attribute
+ tool "IDL"
+ name "Enumeration"
+ value 8)
+ (object Attribute
+ tool "IDL"
+ name "Const"
+ value 71)
+ (object Attribute
+ tool "IDL"
+ name "Exception"
+ value 61)
+ (object Attribute
+ tool "IDL"
+ name "Struct"
+ value 51)
+ (object Attribute
+ tool "IDL"
+ name "Union"
+ value 81)))))
+ (object Attribute
+ tool "IDL"
+ name "default__Module-Spec"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "Generate"
+ value TRUE)
+ (object Attribute
+ tool "IDL"
+ name "CmIdentification"
+ value (value Text " %X% %Q% %Z% %W%"))
+ (object Attribute
+ tool "IDL"
+ name "CopyrightNotice"
+ value (value Text ""))
+ (object Attribute
+ tool "IDL"
+ name "FileName"
+ value "AUTO GENERATE")
+ (object Attribute
+ tool "IDL"
+ name "GenerateIDLModule"
+ value FALSE)
+ (object Attribute
+ tool "IDL"
+ name "InclusionProtectionSymbol"
+ value "AUTO GENERATE")
+ (object Attribute
+ tool "IDL"
+ name "AdditionalIncludes"
+ value (value Text ""))
+ (object Attribute
+ tool "IDL"
+ name "IncludeBySimpleName"
+ value FALSE)))
+ (object Attribute
+ tool "IDL"
+ name "default__Module-Body"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "CmIdentification"
+ value (value Text " %X% %Q% %Z% %W%"))
+ (object Attribute
+ tool "IDL"
+ name "CopyrightNotice"
+ value (value Text ""))
+ (object Attribute
+ tool "IDL"
+ name "FileName"
+ value "AUTO GENERATE")
+ (object Attribute
+ tool "IDL"
+ name "AdditionalIncludes"
+ value (value Text ""))
+ (object Attribute
+ tool "IDL"
+ name "IncludeBySimpleName"
+ value FALSE)))
+ (object Attribute
+ tool "IDL"
+ name "default__Operation"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "OperationIsOneWay"
+ value FALSE)
+ (object Attribute
+ tool "IDL"
+ name "Context"
+ value "")
+ (object Attribute
+ tool "IDL"
+ name "Raises"
+ value "")))
+ (object Attribute
+ tool "IDL"
+ name "default__Attribute"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "CaseSpecifier"
+ value "")
+ (object Attribute
+ tool "IDL"
+ name "GenerateDataMember"
+ value TRUE)
+ (object Attribute
+ tool "IDL"
+ name "DataMemberName"
+ value "$relationship")
+ (object Attribute
+ tool "IDL"
+ name "IsReadOnly"
+ value FALSE)
+ (object Attribute
+ tool "IDL"
+ name "IsConst"
+ value FALSE)
+ (object Attribute
+ tool "IDL"
+ name "ConstValue"
+ value "")))
+ (object Attribute
+ tool "IDL"
+ name "default__Has"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "NameIfUnlabeled"
+ value "the_$supplier")
+ (object Attribute
+ tool "IDL"
+ name "GenerateDataMember"
+ value TRUE)
+ (object Attribute
+ tool "IDL"
+ name "DataMemberName"
+ value "$relationship")
+ (object Attribute
+ tool "IDL"
+ name "GenerateForwardReference"
+ value FALSE)
+ (object Attribute
+ tool "IDL"
+ name "IsReadOnly"
+ value FALSE)
+ (object Attribute
+ tool "IDL"
+ name "BoundedHasRelType"
+ value ("HasRelTypeSet" 47))
+ (object Attribute
+ tool "IDL"
+ name "HasRelTypeSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "Array"
+ value 24)
+ (object Attribute
+ tool "IDL"
+ name "Sequence"
+ value 47)))))
+ (object Attribute
+ tool "IDL"
+ name "default__Role"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "NameIfUnlabeled"
+ value "the_$supplier")
+ (object Attribute
+ tool "IDL"
+ name "GenerateDataMember"
+ value TRUE)
+ (object Attribute
+ tool "IDL"
+ name "DataMemberName"
+ value "$relationship")
+ (object Attribute
+ tool "IDL"
+ name "GenerateForwardReference"
+ value FALSE)
+ (object Attribute
+ tool "IDL"
+ name "IsReadOnly"
+ value FALSE)
+ (object Attribute
+ tool "IDL"
+ name "BoundedRoleType"
+ value ("AssocTypeSet" 47))
+ (object Attribute
+ tool "IDL"
+ name "AssocTypeSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "Array"
+ value 24)
+ (object Attribute
+ tool "IDL"
+ name "Sequence"
+ value 47)))))
+ (object Attribute
+ tool "IDL"
+ name "default__Uses"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "GenerateForwardReference"
+ value FALSE)))
+ (object Attribute
+ tool "IDL"
+ name "default__Subsystem"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "Directory"
+ value "AUTO GENERATE")))
+ (object Attribute
+ tool "IDL"
+ name "HiddenTool"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "propertyId"
+ value "809135966")
+ (object Attribute
+ tool "Java"
+ name "default__Project"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Java"
+ name "CreateMissingDirectories"
+ value TRUE)
+ (object Attribute
+ tool "Java"
+ name "StopOnError"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "Directory"
+ value "AUTO GENERATE")
+ (object Attribute
+ tool "Java"
+ name "UsePrefixes"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "InstanceVariablePrefix"
+ value "m_")
+ (object Attribute
+ tool "Java"
+ name "ClassVariablePrefix"
+ value "s_")
+ (object Attribute
+ tool "Java"
+ name "DefaultAttributeDataType"
+ value "int")
+ (object Attribute
+ tool "Java"
+ name "DefaultOperationReturnType"
+ value "void")))
+ (object Attribute
+ tool "Java"
+ name "default__Class"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Java"
+ name "Final"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "GenerateDefaultConstructor"
+ value TRUE)
+ (object Attribute
+ tool "Java"
+ name "ConstructorIs"
+ value ("Ctor_Set" 62))
+ (object Attribute
+ tool "Java"
+ name "Ctor_Set"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Java"
+ name "Public"
+ value 62)
+ (object Attribute
+ tool "Java"
+ name "Protected"
+ value 63)
+ (object Attribute
+ tool "Java"
+ name "Private"
+ value 64)))
+ (object Attribute
+ tool "Java"
+ name "GenerateFinalizer"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "GenerateStaticInitializer"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "GenerateInstanceInitializer"
+ value FALSE)))
+ (object Attribute
+ tool "Java"
+ name "default__Module-Spec"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Java"
+ name "Generate"
+ value TRUE)
+ (object Attribute
+ tool "Java"
+ name "CmIdentification"
+ value (value Text ""))
+ (object Attribute
+ tool "Java"
+ name "CopyrightNotice"
+ value (value Text ""))
+ (object Attribute
+ tool "Java"
+ name "AdditionalImports"
+ value (value Text ""))))
+ (object Attribute
+ tool "Java"
+ name "default__Module-Body"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Java"
+ name "Generate"
+ value TRUE)
+ (object Attribute
+ tool "Java"
+ name "CmIdentification"
+ value (value Text ""))
+ (object Attribute
+ tool "Java"
+ name "CopyrightNotice"
+ value (value Text ""))
+ (object Attribute
+ tool "Java"
+ name "AdditionalImports"
+ value (value Text ""))))
+ (object Attribute
+ tool "Java"
+ name "default__Operation"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Java"
+ name "Abstract"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "Static"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "Final"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "Native"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "Synchronized"
+ value FALSE)))
+ (object Attribute
+ tool "Java"
+ name "default__Attribute"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Java"
+ name "GenerateDataMember"
+ value TRUE)
+ (object Attribute
+ tool "Java"
+ name "Final"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "Transient"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "Volatile"
+ value FALSE)))
+ (object Attribute
+ tool "Java"
+ name "default__Role"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Java"
+ name "GenerateDataMember"
+ value TRUE)
+ (object Attribute
+ tool "Java"
+ name "ContainerClass"
+ value "")
+ (object Attribute
+ tool "Java"
+ name "InitialValue"
+ value "")
+ (object Attribute
+ tool "Java"
+ name "Final"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "Transient"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "Volatile"
+ value FALSE)))
+ (object Attribute
+ tool "Java"
+ name "HiddenTool"
+ value FALSE)
+ (object Attribute
+ tool "Oracle8"
+ name "propertyId"
+ value "360000002")
+ (object Attribute
+ tool "Oracle8"
+ name "default__Project"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Oracle8"
+ name "DDLScriptFilename"
+ value "DDL1.SQL")
+ (object Attribute
+ tool "Oracle8"
+ name "DropClause"
+ value FALSE)
+ (object Attribute
+ tool "Oracle8"
+ name "PrimaryKeyColumnName"
+ value "_ID")
+ (object Attribute
+ tool "Oracle8"
+ name "PrimaryKeyColumnType"
+ value "NUMBER(5,0)")
+ (object Attribute
+ tool "Oracle8"
+ name "SchemaNamePrefix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "SchemaNameSuffix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "TableNamePrefix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "TableNameSuffix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "TypeNamePrefix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "TypeNameSuffix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "ViewNamePrefix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "ViewNameSuffix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "VarrayNamePrefix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "VarrayNameSuffix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "NestedTableNamePrefix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "NestedTableNameSuffix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "ObjectTableNamePrefix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "ObjectTableNameSuffix"
+ value "")))
+ (object Attribute
+ tool "Oracle8"
+ name "default__Module-Spec"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Oracle8"
+ name "IsSchema"
+ value FALSE)))
+ (object Attribute
+ tool "Oracle8"
+ name "default__Class"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Oracle8"
+ name "OID"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "WhereClause"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "CheckConstraint"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "CollectionTypeLength"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "CollectionTypePrecision"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "CollectionTypeScale"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "CollectionOfREFS"
+ value FALSE)))
+ (object Attribute
+ tool "Oracle8"
+ name "default__Operation"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Oracle8"
+ name "MethodKind"
+ value ("MethodKindSet" 1903))
+ (object Attribute
+ tool "Oracle8"
+ name "OverloadID"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "OrderNumber"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "IsReadNoDataState"
+ value FALSE)
+ (object Attribute
+ tool "Oracle8"
+ name "IsReadNoProcessState"
+ value FALSE)
+ (object Attribute
+ tool "Oracle8"
+ name "IsWriteNoDataState"
+ value FALSE)
+ (object Attribute
+ tool "Oracle8"
+ name "IsWriteNoProcessState"
+ value FALSE)
+ (object Attribute
+ tool "Oracle8"
+ name "IsSelfish"
+ value FALSE)
+ (object Attribute
+ tool "Oracle8"
+ name "TriggerType"
+ value ("TriggerTypeSet" 1801))
+ (object Attribute
+ tool "Oracle8"
+ name "TriggerEvent"
+ value ("TriggerEventSet" 1601))
+ (object Attribute
+ tool "Oracle8"
+ name "TriggerText"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "TriggerReferencingNames"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "TriggerForEach"
+ value ("TriggerForEachSet" 1701))
+ (object Attribute
+ tool "Oracle8"
+ name "TriggerWhenClause"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "MethodKindSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Oracle8"
+ name "MapMethod"
+ value 1901)
+ (object Attribute
+ tool "Oracle8"
+ name "OrderMethod"
+ value 1902)
+ (object Attribute
+ tool "Oracle8"
+ name "Function"
+ value 1903)
+ (object Attribute
+ tool "Oracle8"
+ name "Procedure"
+ value 1904)
+ (object Attribute
+ tool "Oracle8"
+ name "Operator"
+ value 1905)
+ (object Attribute
+ tool "Oracle8"
+ name "Constructor"
+ value 1906)
+ (object Attribute
+ tool "Oracle8"
+ name "Destructor"
+ value 1907)
+ (object Attribute
+ tool "Oracle8"
+ name "Trigger"
+ value 1908)
+ (object Attribute
+ tool "Oracle8"
+ name "Calculated"
+ value 1909)))
+ (object Attribute
+ tool "Oracle8"
+ name "TriggerTypeSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Oracle8"
+ name "AFTER"
+ value 1801)
+ (object Attribute
+ tool "Oracle8"
+ name "BEFORE"
+ value 1802)
+ (object Attribute
+ tool "Oracle8"
+ name "INSTEAD OF"
+ value 1803)))
+ (object Attribute
+ tool "Oracle8"
+ name "TriggerForEachSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Oracle8"
+ name "ROW"
+ value 1701)
+ (object Attribute
+ tool "Oracle8"
+ name "STATEMENT"
+ value 1702)))
+ (object Attribute
+ tool "Oracle8"
+ name "TriggerEventSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Oracle8"
+ name "INSERT"
+ value 1601)
+ (object Attribute
+ tool "Oracle8"
+ name "UPDATE"
+ value 1602)
+ (object Attribute
+ tool "Oracle8"
+ name "DELETE"
+ value 1603)
+ (object Attribute
+ tool "Oracle8"
+ name "INSERT OR UPDATE"
+ value 1604)
+ (object Attribute
+ tool "Oracle8"
+ name "INSERT OR DELETE"
+ value 1605)
+ (object Attribute
+ tool "Oracle8"
+ name "UPDATE OR DELETE"
+ value 1606)
+ (object Attribute
+ tool "Oracle8"
+ name "INSERT OR UPDATE OR DELETE"
+ value 1607)))))
+ (object Attribute
+ tool "Oracle8"
+ name "default__Role"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Oracle8"
+ name "OrderNumber"
+ value "")))
+ (object Attribute
+ tool "Oracle8"
+ name "default__Attribute"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Oracle8"
+ name "OrderNumber"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "IsUnique"
+ value FALSE)
+ (object Attribute
+ tool "Oracle8"
+ name "NullsAllowed"
+ value TRUE)
+ (object Attribute
+ tool "Oracle8"
+ name "Length"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "Precision"
+ value "2")
+ (object Attribute
+ tool "Oracle8"
+ name "Scale"
+ value "6")
+ (object Attribute
+ tool "Oracle8"
+ name "IsIndex"
+ value FALSE)
+ (object Attribute
+ tool "Oracle8"
+ name "IsPrimaryKey"
+ value FALSE)
+ (object Attribute
+ tool "Oracle8"
+ name "CompositeUnique"
+ value FALSE)
+ (object Attribute
+ tool "Oracle8"
+ name "CheckConstraint"
+ value "")))
+ (object Attribute
+ tool "Oracle8"
+ name "HiddenTool"
+ value FALSE)
+ (object Attribute
+ tool "Repository"
+ name "HiddenTool"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "propertyId"
+ value "809135966")
+ (object Attribute
+ tool "cg"
+ name "default__Project"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "UseMSVC"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "HeaderFileExtension"
+ value "h")
+ (object Attribute
+ tool "cg"
+ name "HeaderFileBackupExtension"
+ value "h~")
+ (object Attribute
+ tool "cg"
+ name "HeaderFileTemporaryExtension"
+ value "h#")
+ (object Attribute
+ tool "cg"
+ name "CodeFileExtension"
+ value "cpp")
+ (object Attribute
+ tool "cg"
+ name "CodeFileBackupExtension"
+ value "cp~")
+ (object Attribute
+ tool "cg"
+ name "CodeFileTemporaryExtension"
+ value "cp#")
+ (object Attribute
+ tool "cg"
+ name "CreateMissingDirectories"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "StopOnError"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "ErrorLimit"
+ value 30)
+ (object Attribute
+ tool "cg"
+ name "Directory"
+ value "$ROSECPP_SOURCE")
+ (object Attribute
+ tool "cg"
+ name "PathSeparator"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "FileNameFormat"
+ value "128vx_b")
+ (object Attribute
+ tool "cg"
+ name "BooleanType"
+ value "int")
+ (object Attribute
+ tool "cg"
+ name "AllowTemplates"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "AllowExplicitInstantiations"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "AllowProtectedInheritance"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "CommentWidth"
+ value 60)
+ (object Attribute
+ tool "cg"
+ name "OneByValueContainer"
+ value "$targetClass")
+ (object Attribute
+ tool "cg"
+ name "OneByReferenceContainer"
+ value "$targetClass *")
+ (object Attribute
+ tool "cg"
+ name "OptionalByValueContainer"
+ value "OptionalByValue<$targetClass>")
+ (object Attribute
+ tool "cg"
+ name "OptionalByReferenceContainer"
+ value "$targetClass *")
+ (object Attribute
+ tool "cg"
+ name "FixedByValueContainer"
+ value "$targetClass[$limit]")
+ (object Attribute
+ tool "cg"
+ name "UnorderedFixedByValueContainer"
+ value "$targetClass[$limit]")
+ (object Attribute
+ tool "cg"
+ name "FixedByReferenceContainer"
+ value "$targetClass *[$limit]")
+ (object Attribute
+ tool "cg"
+ name "UnorderedFixedByReferenceContainer"
+ value "$targetClass *[$limit]")
+ (object Attribute
+ tool "cg"
+ name "BoundedByValueContainer"
+ value "BoundedListByValue<$targetClass,$limit>")
+ (object Attribute
+ tool "cg"
+ name "UnorderedBoundedByValueContainer"
+ value "BoundedSetByValue<$targetClass,$limit>")
+ (object Attribute
+ tool "cg"
+ name "BoundedByReferenceContainer"
+ value "BoundedListByReference<$targetClass,$limit>")
+ (object Attribute
+ tool "cg"
+ name "UnorderedBoundedByReferenceContainer"
+ value "BoundedSetByReference<$targetClass,$limit>")
+ (object Attribute
+ tool "cg"
+ name "UnboundedByValueContainer"
+ value "UnboundedListByValue<$targetClass>")
+ (object Attribute
+ tool "cg"
+ name "UnorderedUnboundedByValueContainer"
+ value "UnboundedSetByValue<$targetClass>")
+ (object Attribute
+ tool "cg"
+ name "UnboundedByReferenceContainer"
+ value "UnboundedListByReference<$targetClass>")
+ (object Attribute
+ tool "cg"
+ name "UnorderedUnboundedByReferenceContainer"
+ value "UnboundedSetByReference<$targetClass>")
+ (object Attribute
+ tool "cg"
+ name "QualifiedByValueContainer"
+ value "AssociationByValue<$qualtype, $qualcont>")
+ (object Attribute
+ tool "cg"
+ name "UnorderedQualifiedByValueContainer"
+ value "DictionaryByValue<$qualtype, $qualcont>")
+ (object Attribute
+ tool "cg"
+ name "QualifiedByReferenceContainer"
+ value "AssociationByReference<$qualtype, $qualcont>")
+ (object Attribute
+ tool "cg"
+ name "UnorderedQualifiedByReferenceContainer"
+ value "DictionaryByReference<$qualtype, $qualcont>")
+ (object Attribute
+ tool "cg"
+ name "GeneratePreserveRegions"
+ value TRUE)))
+ (object Attribute
+ tool "cg"
+ name "default__Class"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "CodeName"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "ImplementationType"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "ClassKey"
+ value "class")
+ (object Attribute
+ tool "cg"
+ name "GenerateEmptyRegions"
+ value ("GenerateEmptyRegionSet" 3))
+ (object Attribute
+ tool "cg"
+ name "GenerateEmptyRegionSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "None"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "Preserved"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Unpreserved"
+ value 2)
+ (object Attribute
+ tool "cg"
+ name "All"
+ value 3)))
+ (object Attribute
+ tool "cg"
+ name "PutBodiesInSpec"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateDefaultConstructor"
+ value ("GenerateSet" 199))
+ (object Attribute
+ tool "cg"
+ name "DefaultConstructorVisibility"
+ value ("VisibilitySet" 45))
+ (object Attribute
+ tool "cg"
+ name "InlineDefaultConstructor"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "ExplicitDefaultConstructor"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateCopyConstructor"
+ value ("GenerateSet" 199))
+ (object Attribute
+ tool "cg"
+ name "CopyConstructorVisibility"
+ value ("VisibilitySet" 45))
+ (object Attribute
+ tool "cg"
+ name "InlineCopyConstructor"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "ExplicitCopyConstructor"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateDestructor"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "DestructorVisibility"
+ value ("VisibilitySet" 45))
+ (object Attribute
+ tool "cg"
+ name "DestructorKind"
+ value ("ThreeKindSet" 200))
+ (object Attribute
+ tool "cg"
+ name "InlineDestructor"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateAssignmentOperation"
+ value ("GenerateSet" 199))
+ (object Attribute
+ tool "cg"
+ name "AssignmentVisibility"
+ value ("VisibilitySet" 45))
+ (object Attribute
+ tool "cg"
+ name "AssignmentKind"
+ value ("ThreeKindSet" 200))
+ (object Attribute
+ tool "cg"
+ name "InlineAssignmentOperation"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateEqualityOperations"
+ value ("GenerateSet" 199))
+ (object Attribute
+ tool "cg"
+ name "EqualityVisibility"
+ value ("VisibilitySet" 45))
+ (object Attribute
+ tool "cg"
+ name "EqualityKind"
+ value ("FriendKindSet" 200))
+ (object Attribute
+ tool "cg"
+ name "InlineEqualityOperations"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateRelationalOperations"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "RelationalVisibility"
+ value ("VisibilitySet" 45))
+ (object Attribute
+ tool "cg"
+ name "RelationalKind"
+ value ("FriendKindSet" 200))
+ (object Attribute
+ tool "cg"
+ name "InlineRelationalOperations"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateStorageMgmtOperations"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "StorageMgmtVisibility"
+ value ("VisibilitySet" 45))
+ (object Attribute
+ tool "cg"
+ name "InlineStorageMgmtOperations"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateSubscriptOperation"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "SubscriptVisibility"
+ value ("VisibilitySet" 45))
+ (object Attribute
+ tool "cg"
+ name "SubscriptKind"
+ value ("ThreeKindSet" 200))
+ (object Attribute
+ tool "cg"
+ name "SubscriptResultType"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "InlineSubscriptOperation"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateDereferenceOperation"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "DereferenceVisibility"
+ value ("VisibilitySet" 45))
+ (object Attribute
+ tool "cg"
+ name "DereferenceKind"
+ value ("ThreeKindSet" 200))
+ (object Attribute
+ tool "cg"
+ name "DereferenceResultType"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "InlineDereferenceOperation"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateIndirectionOperation"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "IndirectionVisibility"
+ value ("VisibilitySet" 45))
+ (object Attribute
+ tool "cg"
+ name "IndirectionKind"
+ value ("ThreeKindSet" 200))
+ (object Attribute
+ tool "cg"
+ name "IndirectionResultType"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "InlineIndirectionOperation"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateStreamOperations"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "StreamVisibility"
+ value ("VisibilitySet" 45))
+ (object Attribute
+ tool "cg"
+ name "InlineStreamOperations"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "ThreeKindSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Common"
+ value 200)
+ (object Attribute
+ tool "cg"
+ name "Virtual"
+ value 201)
+ (object Attribute
+ tool "cg"
+ name "Abstract"
+ value 202)))
+ (object Attribute
+ tool "cg"
+ name "KindSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Common"
+ value 200)
+ (object Attribute
+ tool "cg"
+ name "Virtual"
+ value 201)
+ (object Attribute
+ tool "cg"
+ name "Abstract"
+ value 202)
+ (object Attribute
+ tool "cg"
+ name "Static"
+ value 203)))
+ (object Attribute
+ tool "cg"
+ name "FriendKindSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Common"
+ value 200)
+ (object Attribute
+ tool "cg"
+ name "Virtual"
+ value 201)
+ (object Attribute
+ tool "cg"
+ name "Abstract"
+ value 202)
+ (object Attribute
+ tool "cg"
+ name "Friend"
+ value 204)))
+ (object Attribute
+ tool "cg"
+ name "GenerateSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "DeclareAndDefine"
+ value 199)
+ (object Attribute
+ tool "cg"
+ name "DeclareOnly"
+ value 205)
+ (object Attribute
+ tool "cg"
+ name "DoNotDeclare"
+ value 206)))
+ (object Attribute
+ tool "cg"
+ name "VisibilitySet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Public"
+ value 45)
+ (object Attribute
+ tool "cg"
+ name "Protected"
+ value 44)
+ (object Attribute
+ tool "cg"
+ name "Private"
+ value 43)
+ (object Attribute
+ tool "cg"
+ name "Implementation"
+ value 14)))
+ (object Attribute
+ tool "cg"
+ name "ConstValue"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "GenerateDefaultSpecifier"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "DefaultSpecifier"
+ value "")))
+ (object Attribute
+ tool "cg"
+ name "default__Module-Spec"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Generate"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GenerateEmptyRegions"
+ value ("GenerateEmptyRegionSet" 3))
+ (object Attribute
+ tool "cg"
+ name "GenerateEmptyRegionSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "None"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "Preserved"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Unpreserved"
+ value 2)
+ (object Attribute
+ tool "cg"
+ name "All"
+ value 3)))
+ (object Attribute
+ tool "cg"
+ name "CmIdentification"
+ value (value Text " %X% %Q% %Z% %W%"))
+ (object Attribute
+ tool "cg"
+ name "CopyrightNotice"
+ value (value Text ""))
+ (object Attribute
+ tool "cg"
+ name "FileName"
+ value "AUTO GENERATE")
+ (object Attribute
+ tool "cg"
+ name "AllowExtensionlessFileName"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "InclusionProtectionSymbol"
+ value "AUTO GENERATE")
+ (object Attribute
+ tool "cg"
+ name "IncludeFormat"
+ value (value Text
+|// $package
+|#include "$file"
+|
+ ))
+ (object Attribute
+ tool "cg"
+ name "IncludeBySimpleName"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "IncludePrecompiledHeader"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "IncludeOrder"
+ value "AMIR")
+ (object Attribute
+ tool "cg"
+ name "AdditionalIncludes"
+ value (value Text ""))
+ (object Attribute
+ tool "cg"
+ name "InliningStyle"
+ value ("InliningStyleSet" 207))
+ (object Attribute
+ tool "cg"
+ name "InliningStyleSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "InClassDeclaration"
+ value 208)
+ (object Attribute
+ tool "cg"
+ name "FollowingClassDeclaration"
+ value 207)))
+ (object Attribute
+ tool "cg"
+ name "TypesDefined"
+ value (value Text ""))
+ (object Attribute
+ tool "cg"
+ name "IncludeClosure"
+ value (value Text ""))))
+ (object Attribute
+ tool "cg"
+ name "default__Module-Body"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Generate"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GenerateEmptyRegions"
+ value ("GenerateEmptyRegionSet" 3))
+ (object Attribute
+ tool "cg"
+ name "GenerateEmptyRegionSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "None"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "Preserved"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Unpreserved"
+ value 2)
+ (object Attribute
+ tool "cg"
+ name "All"
+ value 3)))
+ (object Attribute
+ tool "cg"
+ name "CmIdentification"
+ value (value Text " %X% %Q% %Z% %W%"))
+ (object Attribute
+ tool "cg"
+ name "CopyrightNotice"
+ value (value Text ""))
+ (object Attribute
+ tool "cg"
+ name "FileName"
+ value "AUTO GENERATE")
+ (object Attribute
+ tool "cg"
+ name "AllowExtensionlessFileName"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "IncludeFormat"
+ value (value Text
+|// $package
+|#include "$file"
+|
+ ))
+ (object Attribute
+ tool "cg"
+ name "IncludeBySimpleName"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "IncludePrecompiledHeader"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "IncludeOrder"
+ value "AMIR")
+ (object Attribute
+ tool "cg"
+ name "AdditionalIncludes"
+ value (value Text ""))
+ (object Attribute
+ tool "cg"
+ name "InliningStyle"
+ value ("InliningStyleSet" 207))
+ (object Attribute
+ tool "cg"
+ name "InliningStyleSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "InClassDeclaration"
+ value 208)
+ (object Attribute
+ tool "cg"
+ name "FollowingClassDeclaration"
+ value 207)))
+ (object Attribute
+ tool "cg"
+ name "TypesDefined"
+ value (value Text ""))
+ (object Attribute
+ tool "cg"
+ name "IncludeClosure"
+ value (value Text ""))))
+ (object Attribute
+ tool "cg"
+ name "default__Operation"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "CodeName"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "OperationKind"
+ value ("OperationKindSet" 200))
+ (object Attribute
+ tool "cg"
+ name "OperationKindSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Common"
+ value 200)
+ (object Attribute
+ tool "cg"
+ name "Virtual"
+ value 201)
+ (object Attribute
+ tool "cg"
+ name "Abstract"
+ value 202)
+ (object Attribute
+ tool "cg"
+ name "Static"
+ value 203)
+ (object Attribute
+ tool "cg"
+ name "Friend"
+ value 204)))
+ (object Attribute
+ tool "cg"
+ name "OperationIsConst"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "OperationIsExplicit"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "Inline"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "EntryCode"
+ value (value Text ""))
+ (object Attribute
+ tool "cg"
+ name "ExitCode"
+ value (value Text ""))
+ (object Attribute
+ tool "cg"
+ name "GenerateEmptyRegions"
+ value ("GenerateEmptyRegionSet" 3))
+ (object Attribute
+ tool "cg"
+ name "GenerateEmptyRegionSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "None"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "Preserved"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Unpreserved"
+ value 2)
+ (object Attribute
+ tool "cg"
+ name "All"
+ value 3)))
+ (object Attribute
+ tool "cg"
+ name "BodyAnnotations"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "OperationIsOneWay"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "Context"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "Raises"
+ value "")))
+ (object Attribute
+ tool "cg"
+ name "default__Has"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "CodeName"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "Ordered"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "NameIfUnlabeled"
+ value "the_$supplier")
+ (object Attribute
+ tool "cg"
+ name "GenerateDataMember"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "DataMemberName"
+ value "$relationship")
+ (object Attribute
+ tool "cg"
+ name "DataMemberVisibility"
+ value ("DataMemberVisibilitySet" 14))
+ (object Attribute
+ tool "cg"
+ name "DataMemberVisibilitySet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Public"
+ value 45)
+ (object Attribute
+ tool "cg"
+ name "Protected"
+ value 44)
+ (object Attribute
+ tool "cg"
+ name "Private"
+ value 43)
+ (object Attribute
+ tool "cg"
+ name "Implementation"
+ value 14)
+ (object Attribute
+ tool "cg"
+ name "AtRelationshipVisibility"
+ value 210)))
+ (object Attribute
+ tool "cg"
+ name "DataMemberMutability"
+ value ("DataMemberMutabilitySet" 0))
+ (object Attribute
+ tool "cg"
+ name "DataMemberMutabilitySet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Unrestricted"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "Mutable"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Const"
+ value 2)))
+ (object Attribute
+ tool "cg"
+ name "DataMemberIsVolatile"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "DataMemberFieldSize"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "InitialValue"
+ value (value Text ""))
+ (object Attribute
+ tool "cg"
+ name "GenerateGetOperation"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GenerateSetOperation"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GetName"
+ value "get_$relationship")
+ (object Attribute
+ tool "cg"
+ name "SetName"
+ value "set_$relationship")
+ (object Attribute
+ tool "cg"
+ name "GetSetKinds"
+ value ("GetSetKindsSet" 200))
+ (object Attribute
+ tool "cg"
+ name "GetSetKindsSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Common"
+ value 200)
+ (object Attribute
+ tool "cg"
+ name "Virtual"
+ value 201)
+ (object Attribute
+ tool "cg"
+ name "Abstract"
+ value 202)
+ (object Attribute
+ tool "cg"
+ name "Static"
+ value 203)
+ (object Attribute
+ tool "cg"
+ name "Friend"
+ value 204)))
+ (object Attribute
+ tool "cg"
+ name "ContainerClass"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "SelectorName"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "SelectorType"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "GetIsConst"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GetResultIsConst"
+ value ("GetResultIsConstSet" 2))
+ (object Attribute
+ tool "cg"
+ name "GetResultIsConstSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "False"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "True"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Same_As_Function"
+ value 2)))
+ (object Attribute
+ tool "cg"
+ name "GetSetByReference"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "InlineGet"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "SetReturnsValue"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "InlineSet"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "ForwardReferenceOnly"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateForwardReference"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "IsReadOnly"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "BoundedHasRelType"
+ value ("HasRelTypeSet" 47))
+ (object Attribute
+ tool "cg"
+ name "HasRelTypeSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Array"
+ value 24)
+ (object Attribute
+ tool "cg"
+ name "Sequence"
+ value 47)))))
+ (object Attribute
+ tool "cg"
+ name "default__Association"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "NameIfUnlabeled"
+ value "the_$targetClass")))
+ (object Attribute
+ tool "cg"
+ name "default__Inherit"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "InstanceArguments"
+ value "")))
+ (object Attribute
+ tool "cg"
+ name "default__Role"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "CodeName"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "ForwardReferenceOnly"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "NameIfUnlabeled"
+ value "the_$targetClass")
+ (object Attribute
+ tool "cg"
+ name "GenerateDataMember"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "DataMemberName"
+ value "$target")
+ (object Attribute
+ tool "cg"
+ name "DataMemberVisibility"
+ value ("DataMemberVisibilitySet" 14))
+ (object Attribute
+ tool "cg"
+ name "DataMemberVisibilitySet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Public"
+ value 45)
+ (object Attribute
+ tool "cg"
+ name "Protected"
+ value 44)
+ (object Attribute
+ tool "cg"
+ name "Private"
+ value 43)
+ (object Attribute
+ tool "cg"
+ name "Implementation"
+ value 14)
+ (object Attribute
+ tool "cg"
+ name "AtRelationshipVisibility"
+ value 210)))
+ (object Attribute
+ tool "cg"
+ name "DataMemberMutability"
+ value ("DataMemberMutabilitySet" 0))
+ (object Attribute
+ tool "cg"
+ name "DataMemberMutabilitySet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Unrestricted"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "Mutable"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Const"
+ value 2)))
+ (object Attribute
+ tool "cg"
+ name "DataMemberIsVolatile"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "DataMemberFieldSize"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "InitialValue"
+ value (value Text ""))
+ (object Attribute
+ tool "cg"
+ name "ContainerClass"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "ContainerGet"
+ value "$data.get($keys)")
+ (object Attribute
+ tool "cg"
+ name "ContainerSet"
+ value "$data.set($keys,$value)")
+ (object Attribute
+ tool "cg"
+ name "QualifiedContainer"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "AssocClassContainer"
+ value "$supplier *")
+ (object Attribute
+ tool "cg"
+ name "AssocClassInitialValue"
+ value (value Text ""))
+ (object Attribute
+ tool "cg"
+ name "GetSetKinds"
+ value ("GetSetKindsSet" 200))
+ (object Attribute
+ tool "cg"
+ name "GetSetKindsSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Common"
+ value 200)
+ (object Attribute
+ tool "cg"
+ name "Virtual"
+ value 201)
+ (object Attribute
+ tool "cg"
+ name "Abstract"
+ value 202)
+ (object Attribute
+ tool "cg"
+ name "Static"
+ value 203)
+ (object Attribute
+ tool "cg"
+ name "Friend"
+ value 204)))
+ (object Attribute
+ tool "cg"
+ name "GetSetByReference"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateGetOperation"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GetName"
+ value "get_$target")
+ (object Attribute
+ tool "cg"
+ name "GetIsConst"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GetResultIsConst"
+ value ("GetResultIsConstSet" 2))
+ (object Attribute
+ tool "cg"
+ name "GetResultIsConstSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "False"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "True"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Same_As_Function"
+ value 2)))
+ (object Attribute
+ tool "cg"
+ name "InlineGet"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GenerateSetOperation"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "SetName"
+ value "set_$target")
+ (object Attribute
+ tool "cg"
+ name "SetReturnsValue"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "InlineSet"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "QualifiedGetSetByReference"
+ value ("QualifiedGetSetByReferenceSet" 2))
+ (object Attribute
+ tool "cg"
+ name "QualifiedGetSetByReferenceSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "False"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "True"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Same_As_GetSetByReference"
+ value 2)))
+ (object Attribute
+ tool "cg"
+ name "GenerateQualifiedGetOperation"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "QualifiedGetName"
+ value "get_$target")
+ (object Attribute
+ tool "cg"
+ name "QualifiedGetIsConst"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "QualifiedGetResultIsConst"
+ value ("GetResultIsConstSet" 2))
+ (object Attribute
+ tool "cg"
+ name "InlineQualifiedGet"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GenerateQualifiedSetOperation"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "QualifiedSetName"
+ value "set_$target")
+ (object Attribute
+ tool "cg"
+ name "QualifiedSetReturnsValue"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "InlineQualifiedSet"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GenerateAssocClassDataMember"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "AssocClassDataMemberName"
+ value "$target")
+ (object Attribute
+ tool "cg"
+ name "AssocClassDataMemberVisibility"
+ value ("DataMemberVisibilitySet" 14))
+ (object Attribute
+ tool "cg"
+ name "DataMemberVisibilitySet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Public"
+ value 45)
+ (object Attribute
+ tool "cg"
+ name "Protected"
+ value 44)
+ (object Attribute
+ tool "cg"
+ name "Private"
+ value 43)
+ (object Attribute
+ tool "cg"
+ name "Implementation"
+ value 14)
+ (object Attribute
+ tool "cg"
+ name "AtRelationshipVisibility"
+ value 210)))
+ (object Attribute
+ tool "cg"
+ name "AssocClassDataMemberMutability"
+ value ("DataMemberMutabilitySet" 0))
+ (object Attribute
+ tool "cg"
+ name "DataMemberMutabilitySet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Unrestricted"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "Mutable"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Const"
+ value 2)))
+ (object Attribute
+ tool "cg"
+ name "AssocClassDataMemberIsVolatile"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "AssocClassGetSetKinds"
+ value ("GetSetKindsSet" 200))
+ (object Attribute
+ tool "cg"
+ name "GenerateAssocClassGetOperation"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "AssocClassGetName"
+ value "get_$target")
+ (object Attribute
+ tool "cg"
+ name "AssocClassGetIsConst"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "AssocClassGetResultIsConst"
+ value ("GetResultIsConstSet" 2))
+ (object Attribute
+ tool "cg"
+ name "InlineAssocClassGet"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GenerateAssocClassSetOperation"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "AssocClassSetName"
+ value "set_$target")
+ (object Attribute
+ tool "cg"
+ name "AssocClassSetReturnsValue"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "InlineAssocClassSet"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "AssocClassForwardReferenceOnly"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GenerateForwardReference"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "IsReadOnly"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "BoundedRoleType"
+ value ("AssocTypeSet" 47))
+ (object Attribute
+ tool "cg"
+ name "AssocTypeSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Array"
+ value 24)
+ (object Attribute
+ tool "cg"
+ name "Sequence"
+ value 47)))))
+ (object Attribute
+ tool "cg"
+ name "default__Attribute"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "CodeName"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "GenerateDataMember"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "DataMemberName"
+ value "$attribute")
+ (object Attribute
+ tool "cg"
+ name "DataMemberVisibility"
+ value ("DataMemberVisibilitySet" 14))
+ (object Attribute
+ tool "cg"
+ name "DataMemberVisibilitySet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Public"
+ value 45)
+ (object Attribute
+ tool "cg"
+ name "Protected"
+ value 44)
+ (object Attribute
+ tool "cg"
+ name "Private"
+ value 43)
+ (object Attribute
+ tool "cg"
+ name "Implementation"
+ value 14)
+ (object Attribute
+ tool "cg"
+ name "AtAttributeVisibility"
+ value 211)))
+ (object Attribute
+ tool "cg"
+ name "DataMemberMutability"
+ value ("DataMemberMutabilitySet" 0))
+ (object Attribute
+ tool "cg"
+ name "DataMemberMutabilitySet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Unrestricted"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "Mutable"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Const"
+ value 2)))
+ (object Attribute
+ tool "cg"
+ name "DataMemberIsVolatile"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "DataMemberFieldSize"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "GenerateGetOperation"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GenerateSetOperation"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GetName"
+ value "get_$attribute")
+ (object Attribute
+ tool "cg"
+ name "SetName"
+ value "set_$attribute")
+ (object Attribute
+ tool "cg"
+ name "GetSetKinds"
+ value ("GetSetKindsSet" 200))
+ (object Attribute
+ tool "cg"
+ name "GetSetKindsSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Common"
+ value 200)
+ (object Attribute
+ tool "cg"
+ name "Virtual"
+ value 201)
+ (object Attribute
+ tool "cg"
+ name "Abstract"
+ value 202)
+ (object Attribute
+ tool "cg"
+ name "Static"
+ value 203)
+ (object Attribute
+ tool "cg"
+ name "Friend"
+ value 204)))
+ (object Attribute
+ tool "cg"
+ name "GetIsConst"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GetResultIsConst"
+ value ("GetResultIsConstSet" 2))
+ (object Attribute
+ tool "cg"
+ name "GetResultIsConstSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "False"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "True"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Same_As_Function"
+ value 2)))
+ (object Attribute
+ tool "cg"
+ name "GetSetByReference"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "InlineGet"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "SetReturnsValue"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "InlineSet"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "CaseSpecifier"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "IsReadOnly"
+ value FALSE)))
+ (object Attribute
+ tool "cg"
+ name "default__Uses"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "ForwardReferenceOnly"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "BodyReferenceOnly"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateForwardReference"
+ value FALSE)))
+ (object Attribute
+ tool "cg"
+ name "default__Subsystem"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Directory"
+ value "AUTO GENERATE")
+ (object Attribute
+ tool "cg"
+ name "DirectoryIsOnSearchList"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "PrecompiledHeader"
+ value "")))
+ (object Attribute
+ tool "cg"
+ name "default__Category"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "IsNamespace"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "Indent"
+ value 2)
+ (object Attribute
+ tool "cg"
+ name "CodeName"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "GenerateEmptyRegions"
+ value ("GenerateEmptyRegionSet" 3))
+ (object Attribute
+ tool "cg"
+ name "GenerateEmptyRegionSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "None"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "Preserved"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Unpreserved"
+ value 2)
+ (object Attribute
+ tool "cg"
+ name "All"
+ value 3)))))
+ (object Attribute
+ tool "MSVC"
+ name "propertyId"
+ value "809135966")
+ (object Attribute
+ tool "MSVC"
+ name "default__Project"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "Version"
+ value "5.0")))
+ (object Attribute
+ tool "MSVC"
+ name "default__Class"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "Type"
+ value ("MSVCClassTypeSet" 0))
+ (object Attribute
+ tool "MSVC"
+ name "MSVCClassTypeSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "Normal"
+ value 0)
+ (object Attribute
+ tool "MSVC"
+ name "Interface_Part"
+ value 1)
+ (object Attribute
+ tool "MSVC"
+ name "Connection_Part"
+ value 2)
+ (object Attribute
+ tool "MSVC"
+ name "Class_Factory"
+ value 3)))
+ (object Attribute
+ tool "MSVC"
+ name "CObjectFunctionality"
+ value ("CObjectFunctionalitySet" 0))
+ (object Attribute
+ tool "MSVC"
+ name "CObjectFunctionalitySet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "None"
+ value 0)
+ (object Attribute
+ tool "MSVC"
+ name "Dynamic"
+ value 1)
+ (object Attribute
+ tool "MSVC"
+ name "Dyncreate"
+ value 2)
+ (object Attribute
+ tool "MSVC"
+ name "Serial"
+ value 3)))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateOverrideGroup"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "GenerateDataGroup"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "AFX_DATA_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateFieldGroup"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "AFX_FIELD_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateMessageGroup"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "GenerateMessageMap"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "AFX_MSG_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "MESSAGE_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "OLEFactory"
+ value ("OLEFactorySet" 0))
+ (object Attribute
+ tool "MSVC"
+ name "OLEFactorySet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "None"
+ value 0)
+ (object Attribute
+ tool "MSVC"
+ name "Built_in"
+ value 1)
+ (object Attribute
+ tool "MSVC"
+ name "Simple"
+ value 2)
+ (object Attribute
+ tool "MSVC"
+ name "Licensed"
+ value 3)))
+ (object Attribute
+ tool "MSVC"
+ name "OLEName"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "OLEClassID"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "GenerateOLECtlType"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "OLECtlType"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "GenerateOLETypeLib"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "OLETypeLibID"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "OLETypeLibMajor"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "OLETypeLibMinor"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "GeneratePropPageIDs"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "OLEPropPageIDs"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateDispatchMap"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "AFX_DISPATCH_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "AFX_DISPATCH_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "DISPATCH_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "StockProperties"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "StockFunctions"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "DispatchDefValue"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "GenerateDispIdEnum"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "AFX_DISP_ID_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateInterfaceMap"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "INTERFACE_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "InitInterface"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "GenerateEventMap"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "AFX_EVENT_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "AFX_EVENT_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "EVENT_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "StockEvents"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateEventSinkMap"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "AFX_EVENTSINK_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "AFX_EVENTSINK_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "EVENTSINK_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "PropNotifySinks"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateConnectionMap"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "CONNECTION_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "ConnectionPointIID"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "InheritanceType"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "DeclSpec"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "OLECommands"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "MFCDeclares"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "MFCImplements"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "ATL_Declares"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateCOMMap"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "COM_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateConnectionPointMap"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "CONNECTION_POINT_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateMsgMap"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "MSG_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GeneratePropertyMap"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "PROPERTY_MAP_Entries"
+ value (value Text ""))))
+ (object Attribute
+ tool "MSVC"
+ name "default__Operation"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "Type"
+ value ("MSVCOperationTypeSet" 0))
+ (object Attribute
+ tool "MSVC"
+ name "MSVCOperationTypeSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "Normal"
+ value 0)
+ (object Attribute
+ tool "MSVC"
+ name "Virtual_Override"
+ value 1)
+ (object Attribute
+ tool "MSVC"
+ name "Message_Handler"
+ value 2)
+ (object Attribute
+ tool "MSVC"
+ name "Dispatch_Handler"
+ value 3)
+ (object Attribute
+ tool "MSVC"
+ name "Event_Firing_Function"
+ value 4)
+ (object Attribute
+ tool "MSVC"
+ name "Event_Sink_Handler"
+ value 5)
+ (object Attribute
+ tool "MSVC"
+ name "Std_OLE_Method"
+ value 6)
+ (object Attribute
+ tool "MSVC"
+ name "Command_Parser"
+ value 7)
+ (object Attribute
+ tool "MSVC"
+ name "Property_Get_Function"
+ value 8)
+ (object Attribute
+ tool "MSVC"
+ name "Property_Set_Function"
+ value 9)
+ (object Attribute
+ tool "MSVC"
+ name "Property_Notify_Function"
+ value 10)
+ (object Attribute
+ tool "MSVC"
+ name "Macro_Generated_Function"
+ value 11)))
+ (object Attribute
+ tool "MSVC"
+ name "AFX_MSG_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "MESSAGE_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "AFX_DISPATCH_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "DISPATCH_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "AFX_EVENT_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "EVENT_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "AFX_EVENTSINK_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "EVENTSINK_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "CallType"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "DeclSpec"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "BodyImage"
+ value (value Text ""))))
+ (object Attribute
+ tool "MSVC"
+ name "default__Role"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "Type"
+ value ("MSVCAttributeTypeSet" 0))
+ (object Attribute
+ tool "MSVC"
+ name "MSVCAttributeTypeSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "Normal"
+ value 0)
+ (object Attribute
+ tool "MSVC"
+ name "Member_Property"
+ value 1)
+ (object Attribute
+ tool "MSVC"
+ name "Get_Set_Property"
+ value 2)
+ (object Attribute
+ tool "MSVC"
+ name "Dialog_Data"
+ value 3)
+ (object Attribute
+ tool "MSVC"
+ name "Field_Data"
+ value 4)
+ (object Attribute
+ tool "MSVC"
+ name "Stock_Property"
+ value 5)))
+ (object Attribute
+ tool "MSVC"
+ name "AFX_DISPATCH_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "DISPATCH_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "DeclSpec"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "PointerBase"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "CallType"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "StockPropertyImplementation"
+ value "")))
+ (object Attribute
+ tool "MSVC"
+ name "default__Has"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "Type"
+ value ("MSVCAttributeTypeSet" 0))
+ (object Attribute
+ tool "MSVC"
+ name "MSVCAttributeTypeSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "Normal"
+ value 0)
+ (object Attribute
+ tool "MSVC"
+ name "Member_Property"
+ value 1)
+ (object Attribute
+ tool "MSVC"
+ name "Get_Set_Property"
+ value 2)
+ (object Attribute
+ tool "MSVC"
+ name "Dialog_Data"
+ value 3)
+ (object Attribute
+ tool "MSVC"
+ name "Field_Data"
+ value 4)
+ (object Attribute
+ tool "MSVC"
+ name "Stock_Property"
+ value 5)))
+ (object Attribute
+ tool "MSVC"
+ name "AFX_DISPATCH_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "DISPATCH_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "DeclSpec"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "PointerBase"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "CallType"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "StockPropertyImplementation"
+ value "")))
+ (object Attribute
+ tool "MSVC"
+ name "default__Attribute"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "Type"
+ value ("MSVCAttributeTypeSet" 0))
+ (object Attribute
+ tool "MSVC"
+ name "MSVCAttributeTypeSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "Normal"
+ value 0)
+ (object Attribute
+ tool "MSVC"
+ name "Member_Property"
+ value 1)
+ (object Attribute
+ tool "MSVC"
+ name "Get_Set_Property"
+ value 2)
+ (object Attribute
+ tool "MSVC"
+ name "Dialog_Data"
+ value 3)
+ (object Attribute
+ tool "MSVC"
+ name "Field_Data"
+ value 4)
+ (object Attribute
+ tool "MSVC"
+ name "Stock_Property"
+ value 5)))
+ (object Attribute
+ tool "MSVC"
+ name "AFX_DISPATCH_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "DISPATCH_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "DeclSpec"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "PointerBase"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "CallType"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "StockPropertyImplementation"
+ value "")))
+ (object Attribute
+ tool "MSVC"
+ name "default__Module-Spec"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "GenerateIncludesGroup"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "AFX_INCLUDES_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateInsertLocation"
+ value FALSE)))
+ (object Attribute
+ tool "MSVC"
+ name "default__Module-Body"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "GenerateIncludesGroup"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "AFX_INCLUDES_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateInsertLocation"
+ value FALSE)))
+ (object Attribute
+ tool "cg"
+ name "HiddenTool"
+ value FALSE)
+ (object Attribute
+ tool "SCC"
+ name "HiddenTool"
+ value FALSE)
+ (object Attribute
+ tool "TypeLibImporter"
+ name "HiddenTool"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "propertyId"
+ value "783606378")
+ (object Attribute
+ tool "Visual Basic"
+ name "default__Class"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Visual Basic"
+ name "CreatableSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Visual Basic"
+ name "Private"
+ value 221)
+ (object Attribute
+ tool "Visual Basic"
+ name "PublicNotCreatable"
+ value 213)
+ (object Attribute
+ tool "Visual Basic"
+ name "SingleUse"
+ value 214)
+ (object Attribute
+ tool "Visual Basic"
+ name "GlobalSingleUse"
+ value 215)
+ (object Attribute
+ tool "Visual Basic"
+ name "MultiUse"
+ value 219)
+ (object Attribute
+ tool "Visual Basic"
+ name "GlobalMultiUse"
+ value 220)))
+ (object Attribute
+ tool "Visual Basic"
+ name "OptionBase"
+ value "0")
+ (object Attribute
+ tool "Visual Basic"
+ name "OptionExplicit"
+ value TRUE)
+ (object Attribute
+ tool "Visual Basic"
+ name "OptionCompare"
+ value ("CompareSet" 202))
+ (object Attribute
+ tool "Visual Basic"
+ name "Creatable"
+ value ("CreatableSet" 221))
+ (object Attribute
+ tool "Visual Basic"
+ name "GenerateInitialization"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "GenerateTermination"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "CollectionClass"
+ value "Collection")
+ (object Attribute
+ tool "Visual Basic"
+ name "CompareSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Visual Basic"
+ name "None"
+ value 202)
+ (object Attribute
+ tool "Visual Basic"
+ name "Binary"
+ value 203)
+ (object Attribute
+ tool "Visual Basic"
+ name "Text"
+ value 204)))))
+ (object Attribute
+ tool "Visual Basic"
+ name "default__Operation"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Visual Basic"
+ name "OperationName"
+ value "$operation")
+ (object Attribute
+ tool "Visual Basic"
+ name "LibraryName"
+ value "")
+ (object Attribute
+ tool "Visual Basic"
+ name "AliasName"
+ value "")
+ (object Attribute
+ tool "Visual Basic"
+ name "IsStatic"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "EntryCode"
+ value (value Text ""))
+ (object Attribute
+ tool "Visual Basic"
+ name "ExitCode"
+ value (value Text ""))))
+ (object Attribute
+ tool "Visual Basic"
+ name "default__Attribute"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Visual Basic"
+ name "IsConst"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "New"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "WithEvents"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "Subscript"
+ value "")
+ (object Attribute
+ tool "Visual Basic"
+ name "NameIfUnlabeled"
+ value "the$supplier")
+ (object Attribute
+ tool "Visual Basic"
+ name "GenerateDataMember"
+ value TRUE)
+ (object Attribute
+ tool "Visual Basic"
+ name "DataMemberName"
+ value "$relationship")
+ (object Attribute
+ tool "Visual Basic"
+ name "GenerateGetOperation"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "GenerateSetOperation"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "GenerateLetOperation"
+ value FALSE)))
+ (object Attribute
+ tool "Visual Basic"
+ name "default__Role"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Visual Basic"
+ name "New"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "WithEvents"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "Subscript"
+ value "")
+ (object Attribute
+ tool "Visual Basic"
+ name "NameIfUnlabeled"
+ value "the$supplier")
+ (object Attribute
+ tool "Visual Basic"
+ name "GenerateDataMember"
+ value TRUE)
+ (object Attribute
+ tool "Visual Basic"
+ name "DataMemberName"
+ value "$relationship")
+ (object Attribute
+ tool "Visual Basic"
+ name "GenerateGetOperation"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "GenerateSetOperation"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "GenerateLetOperation"
+ value FALSE)))
+ (object Attribute
+ tool "Visual Basic"
+ name "default__Inherit"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Visual Basic"
+ name "ImplementsDelegation"
+ value TRUE)))
+ (object Attribute
+ tool "Visual Basic"
+ name "default__Module-Spec"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Visual Basic"
+ name "ProjectFile"
+ value "")))
+ (object Attribute
+ tool "Visual Basic"
+ name "HiddenTool"
+ value FALSE)
+ (object Attribute
+ tool "VisualStudio"
+ name "HiddenTool"
+ value FALSE))
+ quid "4362A29901BD"))
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/AliasTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/AliasTests.java
new file mode 100644
index 0000000000..9ae8ab71c8
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/AliasTests.java
@@ -0,0 +1,136 @@
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.data.BookData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+public class AliasTests extends DasTest{
+
+ protected void setUp() throws Exception {
+
+ super.setUp();
+ new BookData(getAutoConnection()).refresh();
+ }
+
+ /**
+ * Tests the use of column aliasing. The property name change is found in the BooksConfig.xml file
+ * Otherwise similar to testTableAlias
+ *
+ * @throws Exception
+ */
+ public void testColumnAlias() throws Exception{
+
+ DAS das = DAS.FACTORY.createDAS( getConfig("BooksConfigWithAlias.xml") , getConnection());
+
+ Command select = das.getCommand( "get all books" );
+ //select.setConnection( getConnection() );
+
+ DataObject root = select.executeQuery();
+
+ DataObject book = root.getDataObject("Book[2]");
+ book.set( "Writer", "Dr. Seuss");
+
+ das.applyChanges( root );
+
+ select = das.getCommand( "get Cat in the Hat" );
+
+
+ root = select.executeQuery();
+ // Ensure the change actually updated
+ assertEquals( "Dr. Seuss", root.getString( "Book[1]/Writer" ) );
+ }
+
+ /**
+ * Tests to ensure that columns are being properly read when using an Alias, just a bunch of simple
+ * creating, renaming, and deleting of entries while using an alias.
+ */
+ public void testColumnData() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS( getConfig("BooksConfigWithAlias.xml") , getConnection());
+
+ Command select = das.getCommand( "get book by ID" );
+ select.setParameter(1, new Integer(1));
+
+ //*******Verifys a column entry is readable
+ DataObject root = select.executeQuery();
+ assertEquals("Fyodor Dostoevsky", root.getString( "Book[1]/Writer" ) );
+
+ DataObject bookToChange = root.getDataObject("Book[1]");
+ bookToChange.set("Writer", "Fyodor Dostoevskii"); // His last name COULD be spelt like that too!
+
+ das.applyChanges( root );
+
+ //*******Verifys correct information in entry after a column data is changed
+ select = das.getCommand( "get all books" );
+ //select.setConnection(getConnection());
+
+ root = select.executeQuery();
+ assertEquals("Fyodor Dostoevskii", root.getString( "Book[1]/Writer" ) );
+
+ bookToChange = root.getDataObject("Book[1]");
+ bookToChange.delete();
+
+ das.applyChanges( root );
+
+ //*******Verifys correct in table, after entry is deleted
+ select = das.getCommand( "get all books" );
+ //select.setConnection(getConnection());
+
+ root = select.executeQuery();
+ assertEquals( 1, root.getList("Book").size() );
+ assertEquals( "Doctor Seuss", root.getString( "Book[1]/Writer") );
+ }
+
+ /**
+ * Test to check if updating a table works when using Aliasing
+ * Previously this was test_4 in ExceptionTests.
+ */
+ public void testTableAlias() throws Exception {
+
+ // Create Table config programmatically
+ //ConfigHelper helper = new ConfigHelper();
+ //helper.addTable("BOOK", "Book");
+ //helper.addPrimaryKey("BOOK.BOOK_ID");
+
+ DAS das = DAS.FACTORY.createDAS( getConfig("BooksConfigWithAlias.xml"), getConnection() );
+ Command select = das.getCommand( "get book by ID" );
+ select.setParameter(1, new Integer(1));
+
+ DataObject root = select.executeQuery();
+
+
+ DataObject newBook = root.createDataObject("Book");
+ newBook.setString("NAME", "Ant Colonies of the Old World");
+ newBook.setInt("BOOK_ID", 1001);
+ root.getList("Book").add(newBook);
+
+
+ das.applyChanges( root );
+
+
+ root = select.executeQuery();
+
+ //Verify
+ select.setParameter(1, new Integer(1001));
+ root = select.executeQuery();
+
+ assertEquals("Ant Colonies of the Old World", root.getString("Book[1]/NAME"));
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/BestPracticeTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/BestPracticeTests.java
new file mode 100644
index 0000000000..8d9d2ada77
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/BestPracticeTests.java
@@ -0,0 +1,143 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+import java.util.List;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.data.CompanyData;
+import org.apache.tuscany.das.rdb.test.data.CompanyDeptData;
+import org.apache.tuscany.das.rdb.test.data.DepEmpData;
+import org.apache.tuscany.das.rdb.test.data.DepartmentData;
+import org.apache.tuscany.das.rdb.test.data.EmployeeData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+public class BestPracticeTests extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ new CompanyData(getAutoConnection()).refresh();
+ new DepartmentData(getAutoConnection()).refresh();
+ new EmployeeData(getAutoConnection()).refresh();
+ new CompanyDeptData(getAutoConnection()).refresh();
+ new DepEmpData(getAutoConnection()).refresh();
+
+ }
+
+ //Read list of companies
+ public void testReadCompanies() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"), getConnection());
+ Command read = das.getCommand("all companies");
+ DataObject root = read.executeQuery();
+ assertEquals(3, root.getList("COMPANY").size());
+
+ }
+
+ //Read list of companies
+ public void testReadCompaniesWithDepartments() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"), getConnection());
+ Command read = das.getCommand("all companies and departments");
+ DataObject root = read.executeQuery();
+ DataObject firstCompany = root.getDataObject("COMPANY[1]");
+ List departments = firstCompany.getList("departments");
+ assertEquals(0, departments.size());
+
+ }
+
+ public void testddDepartmentToFirstCompany() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"), getConnection());
+ Command read = das.getCommand("all companies and departments");
+ DataObject root = read.executeQuery();
+ DataObject firstCustomer = root.getDataObject("COMPANY[1]");
+ int deptCount = firstCustomer.getList("departments").size();
+
+ DataObject newDepartment = root.createDataObject("DEPARTMENT");
+ firstCustomer.getList("departments").add(newDepartment);
+
+ das.applyChanges(root);
+
+ //verify
+ root = read.executeQuery();
+ firstCustomer = root.getDataObject("COMPANY[1]");
+ assertEquals (deptCount + 1, firstCustomer.getList("departments").size());
+ }
+
+ /**
+ * Test ability to correctly flush heirarchy of objects that have generated
+ * keys
+ */
+ public void testFlushCreateHeirarchy() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"), getConnection());
+ Command select = das.getCommand("all companies and departments");
+ DataObject root = select.executeQuery();
+
+ // Create a new Company
+ DataObject company = root.createDataObject("COMPANY");
+ company.setString("NAME", "Do-rite Pest Control");
+
+ // Create a new Department
+ //Do not set ID or CompanyID since these are generated
+ DataObject department = root.createDataObject("DEPARTMENT");
+ department.setString("NAME", "Do-rite Pest Control");
+ department.setString("LOCATION", "The boonies");
+ department.setString("NUMBER", "101");
+
+ // Associate the new department with the new company
+ company.getList("departments").add(department);
+
+ // Get apply command
+ das.applyChanges(root);
+
+ // Save the id
+ Integer id = (Integer) company.get("ID");
+
+ // Verify the change
+
+ select = das.getCommand("company by id with departments");
+ select.setParameter(1, id);
+ root = select.executeQuery();
+ assertEquals("Do-rite Pest Control", root.getDataObject("COMPANY[1]")
+ .getString("NAME"));
+
+ }
+
+ /**
+ * Test ability to get an empty graph with the Types/Properties intact
+ */
+ public void testGetEmptyGraph() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"), getConnection());
+
+ Command select = das.getCommand("company by id with departments");
+ Integer idOfNoExistingCompany = new Integer(-1);
+ select.setParameter(1, idOfNoExistingCompany);
+ DataObject root = select.executeQuery();
+
+ //Will fail if there is no property named "COMPANY"
+ assertEquals(0, root.getList("COMPANY").size());
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CUDGeneration.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CUDGeneration.java
new file mode 100644
index 0000000000..c7545723ad
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CUDGeneration.java
@@ -0,0 +1,111 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.data.CustomerData;
+import org.apache.tuscany.das.rdb.test.data.OrderData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+public class CUDGeneration extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ new CustomerData(getAutoConnection()).refresh();
+ new OrderData(getAutoConnection()).refresh();
+ }
+
+ /**
+ * This tests provides invalid SQL and should fail on Apply.execute. If not
+ * then the engine is generating CUD and overlooking the provided
+ * statements.
+ */
+ public void testCUDGeneration1() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConfig("basicCustomerMappingWithInvalidCUD.xml"), getConnection());
+
+ // Read customer with particular ID
+ Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
+ DataObject root = select.executeQuery();
+
+ DataObject customer = (DataObject) root.get("CUSTOMER[1]");
+
+ // Modify customer
+ customer.set("LASTNAME", "Pavick");
+
+
+ // Flush changes
+ try {
+ das.applyChanges(root);
+ fail("Should fail with invalid SQL. Provided CUD not used!!");
+ } catch (RuntimeException e) {
+ // Everything OK
+ }
+
+ }
+
+ public void testInsertCUDGeneration() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+
+ Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
+ DataObject root = select.executeQuery();
+
+ DataObject customer = root.createDataObject("CUSTOMER");
+ customer.setInt("ID", 720);
+ customer.set("LASTNAME", "foobar");
+ customer.set("ADDRESS", "asdfasdf");
+
+ das.applyChanges(root);
+
+ select = das.createCommand("select * from CUSTOMER where ID = 720");
+ root = select.executeQuery();
+
+ assertEquals(1, root.getList("CUSTOMER").size());
+ }
+
+ public void testReadModifyApply() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("1xM_mapping_no_cud.xml"), getConnection());
+
+ // Build the select command to read a specific customer and related
+ // orders
+ Command select = das
+ .createCommand(
+ "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = ?");
+
+ // Parameterize the command
+ select.setParameter(1, new Integer(1));
+
+ // Get the graph
+ DataObject root = select.executeQuery();
+
+ // Modify a customer
+ DataObject customer = (DataObject) root.get("Customer[1]");
+ customer.set("LASTNAME", "Pavick");
+
+ // Modify an order
+ DataObject order = (DataObject) customer.get("orders[1]");
+ order.setString("PRODUCT", "Kitchen Sink 001");
+
+ das.applyChanges(root);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java
new file mode 100644
index 0000000000..029816686a
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java
@@ -0,0 +1,176 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+/*
+ * This test
+ *
+ */
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.config.Config;
+import org.apache.tuscany.das.rdb.test.data.CustomerData;
+import org.apache.tuscany.das.rdb.test.data.OrderData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+import org.apache.tuscany.das.rdb.util.ConfigUtil;
+
+import commonj.sdo.DataObject;
+
+/**
+ *
+ * This tests use of the XML Config file. Tests will utilize the
+ * customer-orders-orderdetails tables. The plan is for the config file to have
+ * a section that applies to all commands and another that applies to specific
+ * commands.
+ *
+ * The config file will be used to initialize a command factory that will then
+ * return named commands.
+ *
+ * There will be two read commands:
+ *
+ * 1) Return all customers 2) Return a specific customer (by ID) and related
+ * orders and order details
+ *
+ * A test will demonstrate the creation of the factory and then reuse of
+ * commands created from the same config data file
+ *
+ */
+public class CommandGroupTests extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ new CustomerData(getAutoConnection()).refresh();
+ new OrderData(getAutoConnection()).refresh();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Read
+ */
+ public void testRead() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("CustomersOrdersConfig.xml"), getConnection());
+
+ Command read = das.getCommand("all customers");
+ DataObject root = read.executeQuery();
+
+ assertEquals(5, root.getList("CUSTOMER").size());
+
+ }
+
+ /**
+ * Read
+ */
+ public void testReadUsingConfigInput() throws Exception {
+ Config config = ConfigUtil.loadConfig(getConfig("CustomersOrdersConfig.xml"));
+ DAS das = DAS.FACTORY.createDAS(config, getConnection());
+
+ Command read = das.getCommand("all customers");
+ DataObject root = read.executeQuery();
+
+ assertEquals(5, root.getList("CUSTOMER").size());
+
+ }
+ /**
+ * Read an order using parm marker
+ */
+ public void testReadWithParmmarker() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("CustOrdersConnectionProps.xml"), getConnection());
+
+ Command read = das.getCommand("order by id with ?");
+ read.setParameter(1, new Integer(1));
+ DataObject root = read.executeQuery();
+
+ assertEquals("recombobulator", root.getString("ANORDER[1]/PRODUCT"));
+
+ }
+
+ /**
+ * Specify connection properties in config
+ */
+ public void testReadWithConnectionProperties() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("CustOrdersConnectionProps.xml"), getConnection());
+
+ Command read = das.getCommand("all customers");
+ DataObject root = read.executeQuery();
+
+ assertEquals(5, root.getList("CUSTOMER").size());
+
+ }
+
+ /**
+ * Specify connection properties in config. Add explicit update command
+ */
+ public void testUpdate() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("CustOrdersConnectionProps.xml"), getConnection());
+
+ Command read = das.getCommand("all customers");
+ DataObject root = read.executeQuery();
+ // Verify precondition
+ assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick"));
+ int id = root.getInt("CUSTOMER[1]/ID");
+
+ Command update = das.getCommand("update customer");
+ update.setParameter(1, new Integer(id));
+ update.execute();
+
+ // Verify update - reuse select command
+ root = read.executeQuery();
+ assertEquals("Pavick", root.get("CUSTOMER[1]/LASTNAME"));
+
+ }
+
+ /**
+ * Read all customers, select a specific customer. Then read that customer
+ * and related orders. Modify an order and flush changes back
+ */
+ public void testRead2() throws Exception {
+
+ // Create the group and set common connection
+ DAS das = DAS.FACTORY.createDAS(getConfig("CustomersOrdersConfig.xml"), getConnection());
+
+ // Read all customers and remember the first one
+ Command read = das.getCommand("all customers");
+ DataObject root = read.executeQuery();
+ Integer id = (Integer) root.get("CUSTOMER[1]/ID");
+
+ // Read the specific Customer from above and its related orders
+ Command custOrders = das.getCommand("customer and orders");
+ custOrders.setParameter(1, id);
+ root = custOrders.executeQuery();
+
+ // Modify the first order and flush this change back to the database
+ root.setString("CUSTOMER[1]/orders[1]/PRODUCT", "Defibrillator");
+ Integer orderId = (Integer) root.get("CUSTOMER[1]/orders[1]/ID");
+ das.applyChanges(root);
+
+ // Verify
+ Command orderByID = das.getCommand("order by id");
+ orderByID.setParameter(1, orderId);
+ assertEquals("Defibrillator", root.getString("ANORDER[1]/PRODUCT"));
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java
new file mode 100644
index 0000000000..9ac492d2bb
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java
@@ -0,0 +1,101 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.company.CompanyFactory;
+import org.apache.tuscany.das.rdb.test.company.CompanyType;
+import org.apache.tuscany.das.rdb.test.company.DepartmentType;
+import org.apache.tuscany.das.rdb.test.company.EmployeeType;
+import org.apache.tuscany.das.rdb.test.data.CompanyData;
+import org.apache.tuscany.das.rdb.test.data.CompanyDeptData;
+import org.apache.tuscany.das.rdb.test.data.DepEmpData;
+import org.apache.tuscany.das.rdb.test.data.DepartmentData;
+import org.apache.tuscany.das.rdb.test.data.EmployeeData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import commonj.sdo.DataObject;
+
+public class CompanyTests extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ new CompanyData(getAutoConnection()).refresh();
+ new DepartmentData(getAutoConnection()).refresh();
+ new EmployeeData(getAutoConnection()).refresh();
+ new CompanyDeptData(getAutoConnection()).refresh();
+ new DepEmpData(getAutoConnection()).refresh();
+
+ }
+
+ public void testSimple() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("companyMapping.xml"), getConnection());
+
+ // Build the select command
+ Command selectCommand = das.createCommand("select COMPANY.NAME, "
+ + "EMPLOYEE.NAME, EMPLOYEE.SN, EMPLOYEE.MANAGER, "
+ + "DEPARTMENT.NAME, DEPARTMENT.LOCATION, DEPARTMENT.NUMBER from COMPANY, DEPARTMENT, EMPLOYEE "
+ + "where COMPANY.ID=DEPARTMENT.COMPANYID and DEPARTMENT.ID=EMPLOYEE.DEPARTMENTID");
+
+ // Get the graph
+ DataObject root = selectCommand.executeQuery();
+
+ // Get a company
+ DataObject company = (DataObject) root.getList("CompanyType").get(0);
+ assertEquals("MegaCorp", company.get("NAME"));
+
+ // Get a department
+ DataObject department = (DataObject) company.getList("departments").get(0);
+ assertEquals("Advanced Technologies", department.get("NAME"));
+
+ DataObject employee = (DataObject) department.getList("employees").get(0);
+ assertEquals("John Jones", employee.get("NAME"));
+ }
+
+ public void testSimpleStatic() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("companyMappingWithConverters.xml"), getConnection());
+ SDOUtil.registerStaticTypes(CompanyFactory.class);
+ // Build the select command
+ Command selectCommand = das.createCommand("select COMPANY.NAME, "
+ + "EMPLOYEE.NAME, EMPLOYEE.SN, EMPLOYEE.MANAGER, "
+ + "DEPARTMENT.NAME, DEPARTMENT.LOCATION, DEPARTMENT.NUMBER from COMPANY, DEPARTMENT, EMPLOYEE "
+ + "where COMPANY.ID=DEPARTMENT.COMPANYID and DEPARTMENT.ID=EMPLOYEE.DEPARTMENTID");
+
+
+ // Get the graph
+ DataObject root = selectCommand.executeQuery();
+
+
+ CompanyType company = (CompanyType) root.getList("CompanyType").get(0);
+
+ assertEquals("MegaCorp", company.getName());
+
+ // Get a department
+ DepartmentType department = (DepartmentType) company.getDepartments().get(0);
+ assertEquals("Advanced Technologies", department.getName());
+
+ EmployeeType employee = (EmployeeType) department.getEmployees().get(0);
+
+ assertEquals("John Jones", employee.getName());
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyTests.java
new file mode 100644
index 0000000000..450933928e
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyTests.java
@@ -0,0 +1,95 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.data.OrderData;
+import org.apache.tuscany.das.rdb.test.data.OrderDetailsData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+/**
+ * Tests for Compound Keys
+ */
+public class CompoundKeyTests extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ new OrderDetailsData(getAutoConnection()).refresh();
+ new OrderData(getAutoConnection()).refresh();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testRead() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command getOrderDetails = das
+ .createCommand("Select * from ORDERDETAILS where ORDERID = ? AND PRODUCTID = ?");
+
+
+ getOrderDetails.setParameter(1, new Integer(1));
+ getOrderDetails.setParameter(2, new Integer(1));
+
+ DataObject root = getOrderDetails.executeQuery();
+
+ DataObject orderDetail = (DataObject) root.get("ORDERDETAILS[1]");
+ assertEquals(1.1f, orderDetail.getFloat("PRICE"), 0.01);
+
+ }
+
+ public void testReadModifyWrite2() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConfig("OrdersOrderDetailsConfig.xml"), getConnection());
+ Command getOrderDetails = das
+ .createCommand("Select * from ORDERDETAILS where ORDERID = 1 AND PRODUCTID = 1");
+
+ DataObject root = getOrderDetails.executeQuery();
+
+ DataObject orderDetails = (DataObject) root.get("ORDERDETAILS[1]");
+ assertEquals(1.1f, orderDetails.getFloat("PRICE"), 0.01);
+
+ // Modify
+ orderDetails.setFloat("PRICE", 0f);
+
+ // Build apply changes command
+
+ das.applyChanges(root);
+
+ // Verify
+ root = getOrderDetails.executeQuery();
+ orderDetails = root.getDataObject("ORDERDETAILS[1]");
+ assertEquals(0f, orderDetails.getFloat("PRICE"), 0.01);
+
+ }
+
+ public void testReadOrdersAndDetails2() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConfig("OrdersOrderDetailsConfig.xml"), getConnection());
+ Command read = das
+ .createCommand("SELECT * FROM ANORDER LEFT JOIN ORDERDETAILS ON ANORDER.ID = ORDERDETAILS.ORDERID ORDER BY ANORDER.ID");
+
+ DataObject root = read.executeQuery();
+
+ DataObject firstOrder = root.getDataObject("ANORDER[1]");
+ assertEquals(1, firstOrder.getInt("ID"));
+ assertEquals(2, firstOrder.getList("ORDERDETAILS").size());
+
+ }
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java
new file mode 100644
index 0000000000..fe7c87a0da
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java
@@ -0,0 +1,102 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.data.CustomerData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+/**
+ * Tests the Converter framwork
+ */
+public class ConverterTests extends DasTest {
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ new CustomerData(getAutoConnection()).refresh();
+ }
+
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ private static DateFormat myformat = new SimpleDateFormat("yyyy.MM.dd");
+
+ private static Date kbday;
+ private static Date tbday;
+
+ static {
+ try {
+ kbday = myformat.parse("1957.09.27");
+ tbday = myformat.parse("1966.12.20");
+ } catch (ParseException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+
+
+ /**
+ * This tests the use of an arbitrary converter. The column converted is a VARCAHAR.
+ * ResultSetShape is used to specify that the property will be a SDODataTypes.DATE.
+ *
+ * So this example uses a converter that transforms a string column into a date property
+ * and conversely, a date property back to a string for the underlying column.
+ *
+ * The converter returns 1957.09.27 if the column value is "Williams" and 1966.12.20
+ * if the value is "Pavick"
+ *
+ * On write, the converter returns "Pavick" if the property value is 1966.12.20
+ * and "Williams" if the property value is 1957.09.27
+ *
+ */
+ public void testArbitraryConverter() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConfig("CustomerConfigWithConverter.xml"), getConnection());
+
+ //Create and initialize command to read customers
+ Command read = das.getCommand("testArbitraryConverter");
+
+ //Read
+ DataObject root = read.executeQuery();
+
+ //Verify
+ assertEquals(kbday, root.getDate("CUSTOMER[1]/LASTNAME"));
+
+ //Modify
+ root.setDate("CUSTOMER[1]/LASTNAME", tbday);
+
+ das.applyChanges(root);
+
+ //Read
+ root = read.executeQuery();
+
+ //Verify
+ assertEquals(tbday, root.getDate("CUSTOMER[1]/LASTNAME"));
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java
new file mode 100644
index 0000000000..492e70352c
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java
@@ -0,0 +1,307 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+/*
+ * These tests attempt to duplicate customer reported errors and then to verify
+ * any necessary fix.
+ *
+ */
+
+import java.util.Iterator;
+import java.util.Random;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.ConfigHelper;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.data.CompanyData;
+import org.apache.tuscany.das.rdb.test.data.CompanyDeptData;
+import org.apache.tuscany.das.rdb.test.data.CustomerData;
+import org.apache.tuscany.das.rdb.test.data.DepartmentData;
+import org.apache.tuscany.das.rdb.test.data.OrderData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+public class CorrectedDefectTests extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ new CustomerData(getAutoConnection()).refresh();
+ new OrderData(getAutoConnection()).refresh();
+
+ new CompanyData(getAutoConnection()).refresh();
+ new DepartmentData(getAutoConnection()).refresh();
+ new CompanyDeptData(getAutoConnection()).refresh();
+
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Dilton's bug for adding new child data object
+ */
+ public void testAddNewOrder() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConfig("CustomersOrdersConfig.xml"), getConnection());
+ // Read some customers and related orders
+ Command select = das.createCommand(
+ "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID");
+
+ DataObject root = select.executeQuery();
+
+ DataObject cust = root.getDataObject("CUSTOMER[1]");
+
+ // Save ID and Order Count
+ int custID = cust.getInt("ID");
+ int custOrderCount = cust.getList("orders").size();
+
+ // Create a new Order and add to customer1
+ DataObject order = root.createDataObject("ANORDER");
+
+ order.set("ID", new Integer(99));
+ order.set("PRODUCT", "The 99th product");
+ order.set("QUANTITY", new Integer(99));
+ cust.getList("orders").add(order);
+
+ assertEquals(custOrderCount + 1, cust.getList("orders").size());
+
+ // Build apply changes command
+ das.applyChanges(root);
+
+ // verify cust1 relationship updates
+ select = das
+ .createCommand("SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = ?");
+
+ select.setParameter(1, new Integer(custID));
+ root = select.executeQuery();
+
+ assertEquals(custOrderCount + 1, root.getList("CUSTOMER[1]/orders").size());
+
+ }
+
+ public void testDiltonsInsertWorkaround() throws Exception {
+
+ // String sql = "insert into conmgt.serverstatus (statusid,
+ // managedserverid, timestamp) values (316405209, 316405209, '2005-11-23
+ // 19:29:52.636')";
+ // String sql = "insert into conmgt.serverstatus (managedserverid,
+ // timestamp) values (316405209, '2005-11-23 19:29:52.636')";
+ String sql = "insert into conmgt.serverstatus (managedserverid, timestamp) values (?, ?)";
+
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command insert = das.createCommand(sql);
+ insert.setParameter(1, new Integer(316405209));
+ insert.setParameter(2, "2005-11-23 19:29:52.636");
+ insert.execute();
+
+ // Verify
+ Command select = das.createCommand("Select * from conmgt.serverstatus");
+ DataObject root = select.executeQuery();
+ assertEquals(1, root.getList("SERVERSTATUS").size());
+
+ }
+
+ public void testWASDefect330118() throws Exception {
+
+ // Create the group and set common connection
+ DAS das = DAS.FACTORY
+ .createDAS(getConfig("CustomersOrdersConfig.xml"), getConnection());
+
+ // Read all customers and add one
+ Command read = das.getCommand("all customers");
+ DataObject root = read.executeQuery();
+ int numCustomers = root.getList("CUSTOMER").size();
+
+ DataObject newCust = root.createDataObject("CUSTOMER");
+ newCust.set("ID", new Integer(100));
+ newCust.set("ADDRESS", "5528 Wells Fargo Drive");
+ newCust.set("LASTNAME", "Gerkin");
+
+ // Now delete this new customer
+ newCust.delete();
+
+ das.applyChanges(root);
+
+ // Verify
+ root = read.executeQuery();
+ assertEquals(numCustomers, root.getList("CUSTOMER").size());
+
+ }
+
+ /**
+ * Should be able to explicitly set a parameter to null. But, should require
+ * that the parameter type is set.
+ */
+ public void testDiltonsNullParameterBug1() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command insert = das.createCommand("insert into CUSTOMER values (?, ?, ?)");
+ insert.setParameter(1, new Integer(10));
+ insert.setParameter(2, null);
+ insert.setParameter(3, "5528 Wells Fargo Dr");
+ insert.execute();
+
+ // Verify
+ Command select = das.createCommand("Select * from CUSTOMER where ID = 10");
+ DataObject root = select.executeQuery();
+ assertEquals(1, root.getList("CUSTOMER").size());
+ assertEquals("5528 Wells Fargo Dr", root.get("CUSTOMER[1]/ADDRESS"));
+
+ }
+
+ /**
+ * Error by not setting a parameter
+ */
+ public void testDiltonsNullParameterBug2() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command insert = das.createCommand("insert into CUSTOMER values (?, ?, ?)");
+ insert.setParameter(1, new Integer(10));
+ // insert.setParameterValue("LASTNAME", null);
+ insert.setParameter(3, "5528 Wells Fargo Dr");
+
+ try {
+ insert.execute();
+ fail();
+ } catch (RuntimeException e) {
+ // Expected since "LASTNAME" parameter not set
+ }
+ }
+
+ /**
+ * Set parameter to empty string
+ */
+ public void testDiltonsNullParameterBug3() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command insert = das.createCommand("insert into CUSTOMER values (?, ?, ?)");
+ insert.setParameter(1, new Integer(10));
+ insert.setParameter(2, "");
+ insert.setParameter(3, "5528 Wells Fargo Dr");
+ insert.execute();
+
+ // Verify
+ Command select = das.createCommand("Select * from CUSTOMER where ID = 10");
+ DataObject root = select.executeQuery();
+ assertEquals(1, root.getList("CUSTOMER").size());
+ assertEquals("5528 Wells Fargo Dr", root.get("CUSTOMER[1]/ADDRESS"));
+
+ }
+
+ public void testUpdateChildThatHasGeneratedKey() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"), getConnection());
+
+ // Read a specific company based on the known ID
+ Command readCust = das.getCommand("all companies and departments");
+ DataObject root = readCust.executeQuery();
+ DataObject lastCustomer = root.getDataObject("COMPANY[3]");
+ Iterator i = lastCustomer.getList("departments").iterator();
+ Random generator = new Random();
+ int random = generator.nextInt(1000) + 1;
+ DataObject department;
+ while (i.hasNext()) {
+ department = (DataObject) i.next();
+ // System.out.println("Modifying department: " +
+ // department.getString("NAME"));
+ department.setString("NAME", "Dept-" + random);
+ random = random + 1;
+ }
+
+ das.applyChanges(root);
+ }
+
+ /**
+ * Yin Chen reports ... "In the class Statement, method: public int
+ * executeUpdate(Parameters parameters) - its tossing out RuntimeException
+ * when the value of the parameter is null. "
+ *
+ * His example build a update statement and sets one parameter value to be
+ * null. I will try to duplicate with an insert since that is simpler
+ *
+ */
+ public void testYingChen12162005() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command insert = das
+ .createCommand("insert into CUSTOMER values (?, ?, ?)");
+ insert.setParameter(1, new Integer(10));
+ insert.setParameter(2, "Williams");
+ insert.setParameter(3, null);
+ insert.execute();
+
+ // Verify
+ Command select = das.createCommand("Select * from CUSTOMER where ID = 10");
+ DataObject root = select.executeQuery();
+ assertEquals(1, root.getList("CUSTOMER").size());
+ assertNull(root.get("CUSTOMER[1]/ADDRESS"));
+
+ }
+
+ /**
+ * Formely tests concerning Tuscany-433. The error causing these tests was cleared up when
+ * the method for handling parameters was changed.
+ */
+ public void testReadModifyApply()
+ throws Exception
+ {
+
+
+ // Provide updatecommand programmatically via config
+ ConfigHelper helper = new ConfigHelper();
+ helper.addUpdateStatement("update CUSTOMER set LASTNAME = ? where ID = ?", "CUSTOMER", "LASTNAME ID");
+
+ DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection());
+
+ //Read customer 1
+ Command select = das.createCommand( "Select * from CUSTOMER where ID = 1" );
+ DataObject root = select.executeQuery();
+
+ DataObject customer = (DataObject) root.get( "CUSTOMER[1]" );
+
+ //Modify customer
+ customer.set( "LASTNAME", "Pavick" );
+
+ das.applyChanges( root );
+
+ //Verify changes
+ root = select.executeQuery();
+ assertEquals( "Pavick", root.getString( "CUSTOMER[1]/LASTNAME" ) );
+
+ }
+
+ public void testReadModifyApply1()
+ throws Exception
+ {
+ DAS das = DAS.FACTORY.createDAS(getConfig("basicCustomerMappingWithCUD2.xml"), getConnection());
+ //Read customer 1
+ Command select = das.createCommand( "Select * from CUSTOMER where ID = 1" );
+ DataObject root = select.executeQuery();
+
+ DataObject customer = (DataObject) root.get( "CUSTOMER[1]" );
+
+ //Modify customer
+ customer.set( "LASTNAME", "Pavick" );
+
+ //Build apply changes command
+ das.applyChanges( root );
+
+ //Verify changes
+ root = select.executeQuery();
+ assertEquals( "Pavick", root.getString( "CUSTOMER[1]/LASTNAME" ) );
+
+ }
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java
new file mode 100644
index 0000000000..71b6da3f52
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java
@@ -0,0 +1,316 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+/*
+ * This provdes the simplest examples that make use of the change history. The
+ * assumptions are:
+ *
+ * Single type Change history utilized Dynamic DataObjects
+ *
+ *
+ */
+
+import java.util.Iterator;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.ConfigHelper;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.data.CustomerData;
+import org.apache.tuscany.das.rdb.test.data.OrderDetailsData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+public class CrudWithChangeHistory extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ new CustomerData(getAutoConnection()).refresh();
+ new OrderDetailsData(getAutoConnection()).refresh();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Read and modify a customer. Provide needed Create/Update/Delete
+ * statements programatically
+ */
+ public void testReadModifyApply() throws Exception {
+
+ // Provide updatecommand programmatically via config
+ ConfigHelper helper = new ConfigHelper();
+ helper.addUpdateStatement("update CUSTOMER set LASTNAME = ?, ADDRESS = ? where ID = ?",
+ "CUSTOMER", "LASTNAME ADDRESS ID");
+
+ DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection());
+ // Read customer 1
+ Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
+ DataObject root = select.executeQuery();
+
+ DataObject customer = (DataObject) root.get("CUSTOMER[1]");
+
+ // Modify customer
+ customer.set("LASTNAME", "Pavick");
+
+ // Build apply changes command
+ das.applyChanges(root);
+
+ // Verify changes
+ root = select.executeQuery();
+ assertEquals("Pavick", root.getString("CUSTOMER[1]/LASTNAME"));
+
+ }
+
+ /**
+ * Read and modify a customer. Provide needed Create/Update/Delete
+ * statements via xml file
+ */
+ public void testReadModifyApply1() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("basicCustomerMappingWithCUD.xml"), getConnection());
+ // Read customer 1
+ Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
+ DataObject root = select.executeQuery();
+
+ DataObject customer = (DataObject) root.get("CUSTOMER[1]");
+
+ // Modify customer
+ customer.set("LASTNAME", "Pavick");
+
+ // Build apply changes command
+ das.applyChanges(root);
+
+ // Verify changes
+ root = select.executeQuery();
+ assertEquals("Pavick", root.getString("CUSTOMER[1]/LASTNAME"));
+
+ }
+
+ /**
+ * Same as previous but: Utilizes generated CUD statements Key info provided
+ * programatically
+ */
+ public void testReadModifyApply2() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ // Read customer with particular ID
+ Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
+ DataObject root = select.executeQuery();
+
+ DataObject customer = root.getDataObject("CUSTOMER[1]");
+
+ // Modify customer
+ customer.set("LASTNAME", "Pavick");
+
+ // Build apply changes command
+ das.applyChanges(root);
+
+ // Verify the change
+ root = select.executeQuery();
+ assertEquals("Pavick", root.getDataObject("CUSTOMER[1]").getString("LASTNAME"));
+
+ }
+
+ /**
+ * Builds on previous but: 1. Key info provided via XML file
+ */
+ public void testReadModifyApply3() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConfig("basicCustomerMapping.xml"), getConnection());
+ // Read customer with particular ID
+ Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
+ DataObject root = select.executeQuery();
+
+ DataObject customer = (DataObject) root.get("CUSTOMER[1]");
+
+ // Modify customer
+ customer.set("LASTNAME", "Pavick");
+
+ // Build apply changes command
+ das.applyChanges(root);
+
+ // Verify the change
+ root = select.executeQuery();
+ assertEquals("Pavick", root.getDataObject("CUSTOMER[1]").getString("LASTNAME"));
+
+ }
+
+ /**
+ * Test ability to handle multiple changes to the graph including
+ * Creates/Updates/Deletes Employs generated CUD
+ */
+ public void testReadModifyDeleteInsertApply() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("basicCustomerMapping.xml"), getConnection());
+ // Read some customers
+ Command select = das.createCommand("Select * from CUSTOMER where LASTNAME = 'Williams'");
+ DataObject root = select.executeQuery();
+
+ DataObject cust1 = (DataObject) root.getList("CUSTOMER").get(0);
+ DataObject cust2 = (DataObject) root.getList("CUSTOMER").get(1);
+ DataObject cust3 = (DataObject) root.getList("CUSTOMER").get(2);
+
+ // Modify a customer
+ cust1.set("LASTNAME", "Pavick");
+ int cust1ID = cust1.getInt("ID");
+
+ // Save IDs before delete
+ int cust2ID = cust2.getInt("ID");
+ int cust3ID = cust3.getInt("ID");
+ // Delete a couple
+ cust2.delete();
+ cust3.delete();
+
+ // Create a new customer
+ DataObject cust4 = root.createDataObject("CUSTOMER");
+ cust4.set("ID", new Integer(100));
+ cust4.set("ADDRESS", "5528 Wells Fargo Drive");
+ cust4.set("LASTNAME", "Gerkin");
+
+ // Build apply changes command
+ das.applyChanges(root);
+
+ // Verify deletes
+ select = das.createCommand("Select * from CUSTOMER where ID = ?");
+ select.setParameter(1, new Integer(cust2ID));
+ root = select.executeQuery();
+ assertTrue(root.getList("CUSTOMER").isEmpty());
+ // reparameterize same command
+ select.setParameter(1, new Integer(cust3ID));
+ root = select.executeQuery();
+ assertTrue(root.getList("CUSTOMER").isEmpty());
+
+ // verify insert
+ select.setParameter(1, new Integer(100));
+ root = select.executeQuery();
+ assertEquals(1, root.getList("CUSTOMER").size());
+ assertEquals("5528 Wells Fargo Drive", root.getString("CUSTOMER[1]/ADDRESS"));
+ assertEquals("Gerkin", root.getString("CUSTOMER[1]/LASTNAME"));
+
+ // verify update
+ select.setParameter(1, new Integer(cust1ID));
+ root = select.executeQuery();
+ assertEquals("Pavick", root.getString("CUSTOMER[1]/LASTNAME"));
+
+ }
+
+ public void testReadModifyApplyWithAssumedID() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ // Read customer with particular ID
+ Command select = das.createCommand("Select * from CUSTOMER");
+ DataObject root = select.executeQuery();
+
+ DataObject customer = root.getDataObject("CUSTOMER[1]");
+
+ // Modify customer
+ customer.set("LASTNAME", "Pavick");
+
+ DataObject customerForDelete = root.getDataObject("CUSTOMER[2]");
+ String deletedLastName = customerForDelete.getString("LASTNAME");
+ customerForDelete.delete();
+
+ DataObject newCustomer = root.createDataObject("CUSTOMER");
+ newCustomer.set("LASTNAME", "NewCustomer");
+ newCustomer.setInt("ID", 9000);
+
+ // Build apply changes command
+ das.applyChanges(root);
+
+ // Verify the change
+ root = select.executeQuery();
+ assertEquals("Pavick", getCustomerByLastName(root, "Pavick").getString("LASTNAME"));
+ assertEquals("NewCustomer", getCustomerByLastName(root, "NewCustomer").getString("LASTNAME"));
+ assertNull(getCustomerByLastName(root, deletedLastName));
+
+ }
+
+ public void testReadModifyApplyWithAssumedIDFailure() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command select = das.createCommand("Select * from ORDERDETAILS");
+
+ DataObject root = select.executeQuery();
+
+ DataObject od = root.getDataObject("ORDERDETAILS[1]");
+
+ // Modify customer
+ od.setInt("PRODUCTID", 72);
+
+ // Flush changes -- This should fail because Order Details does not have
+ // a column that
+ // we can assume to be an ID
+ try {
+ das.applyChanges(root);
+ } catch (RuntimeException ex) {
+ assertTrue(ex.getMessage().contains("changed in the DataGraph but is not present in the Config"));
+ }
+
+ }
+
+ public void testReadModifyApplyWithAssumedIDFailure2() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command select = das.createCommand("Select * from ORDERDETAILS");
+ DataObject root = select.executeQuery();
+
+ DataObject od = root.getDataObject("ORDERDETAILS[1]");
+ od.delete();
+
+ // Flush changes -- This should fail because Order Details does not have
+ // a column that
+ // we can assume to be an ID
+ try {
+ das.applyChanges(root);
+ } catch (RuntimeException ex) {
+ assertTrue(ex.getMessage().contains("changed in the DataGraph but is not present in the Config"));
+ }
+
+ }
+
+ public void testReadModifyApplyWithAssumedIDFailure3() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command select = das.createCommand("Select * from ORDERDETAILS");
+ DataObject root = select.executeQuery();
+
+ DataObject od = root.createDataObject("ORDERDETAILS");
+
+ // Modify customer
+ od.setInt("PRODUCTID", 72);
+ od.setInt("ORDERID", 500);
+
+ // Flush changes -- This should fail because Order Details does not have
+ // a column that
+ // we can assume to be an ID
+ try {
+ das.applyChanges(root);
+ } catch (RuntimeException ex) {
+ assertTrue(ex.getMessage().contains("changed in the DataGraph but is not present in the Config"));
+ }
+
+ }
+
+ private DataObject getCustomerByLastName(DataObject root, String name) {
+ Iterator i = root.getList("CUSTOMER").iterator();
+ while (i.hasNext()) {
+ DataObject obj = (DataObject) i.next();
+ if (name.equals(obj.getString("LASTNAME")))
+ return obj;
+ }
+ return null;
+ }
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java
new file mode 100644
index 0000000000..4f8982a140
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java
@@ -0,0 +1,106 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+/*
+ * These tests attempt to duplicate customer reported errors and then to verify
+ * any necessary fix.
+ *
+ */
+
+import java.util.Iterator;
+import java.util.Random;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.ConfigHelper;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.data.CompanyData;
+import org.apache.tuscany.das.rdb.test.data.CompanyDeptData;
+import org.apache.tuscany.das.rdb.test.data.CustomerData;
+import org.apache.tuscany.das.rdb.test.data.DepEmpData;
+import org.apache.tuscany.das.rdb.test.data.DepartmentData;
+import org.apache.tuscany.das.rdb.test.data.EmployeeData;
+import org.apache.tuscany.das.rdb.test.data.OrderData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+public class DefectTests extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ new CustomerData(getAutoConnection()).refresh();
+ new OrderData(getAutoConnection()).refresh();
+
+ new CompanyData(getAutoConnection()).refresh();
+ new DepartmentData(getAutoConnection()).refresh();
+ new EmployeeData(getAutoConnection()).refresh();
+ new CompanyDeptData(getAutoConnection()).refresh();
+ new DepEmpData(getAutoConnection()).refresh();
+
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Read a specific customer
+ */
+ public void testDiltonsInsert() throws Exception {
+
+ // String sql = "insert into conmgt.serverstatus (statusid,
+ // managedserverid, timestamp) values (316405209, 316405209, '2005-11-23
+ // 19:29:52.636')";
+ String sql = "insert into conmgt.serverstatus (managedserverid, timestamp) values (316405209, '2005-11-23 19:29:52.636')";
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command insert = das.createCommand(sql);
+ insert.execute();
+
+ // Verify
+ Command select = das
+ .createCommand("Select * from conmgt.serverstatus where statusid = 316405209");
+ DataObject root = select.executeQuery();
+ assertEquals(1, root.getList("conmgt.serverstatus").size());
+
+ }
+
+
+ public void testUpdateChildThatHasGeneratedKey() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"));
+
+ //Read a specific company based on the known ID
+ Command readCust = das.getCommand("all companies and departments");
+ DataObject root = readCust.executeQuery();
+ DataObject lastCustomer = root.getDataObject("COMPANY[3]");
+ Iterator i = lastCustomer.getList("departments").iterator();
+ Random generator = new Random();
+ int random = generator.nextInt(1000) + 1;
+ DataObject department;
+ while (i.hasNext()) {
+ department = (DataObject)i.next();
+ System.out.println("Modifying department: " + department.getString("NAME"));
+ department.setString("NAME", "Dept-" + random);
+ random = random + 1;
+ }
+
+ das.applyChanges(root);
+
+ }
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java
new file mode 100644
index 0000000000..677cfecae9
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java
@@ -0,0 +1,137 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+import java.sql.Connection;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.customer.CustomerFactory;
+import org.apache.tuscany.das.rdb.test.data.BookData;
+import org.apache.tuscany.das.rdb.test.data.CustomerData;
+import org.apache.tuscany.das.rdb.test.data.OrderData;
+import org.apache.tuscany.das.rdb.test.data.OrderDetailsData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+public class ExceptionTests extends DasTest {
+
+ public ExceptionTests() {
+ super();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ new CustomerData(getAutoConnection()).refresh();
+ new OrderData(getAutoConnection()).refresh();
+ new BookData(getAutoConnection()).refresh();
+ new OrderDetailsData(getAutoConnection()).refresh();
+
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testMissingConnection() throws Exception {
+ DAS das = DAS.FACTORY.createDAS((Connection)null);
+
+ try {
+ Command readCustomers = das.createCommand("select * from CUSTOMER where ID = 1");
+ readCustomers.executeQuery();
+ fail("RuntimeException should be thrown");
+ } catch (RuntimeException ex) {
+ assertEquals("No connection has been provided and no data source has been specified", ex.getMessage());
+ }
+
+ }
+
+ public void testUnregisteredTypes() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConfig("staticInvalid.xml"), getConnection());
+ Command readCustomers = das.createCommand("select * from CUSTOMER where ID = 1");
+
+ try {
+ readCustomers.executeQuery();
+
+ fail("Exception should be thrown");
+ } catch (RuntimeException ex) {
+ assertEquals("SDO Types have not been registered for URI invalidURI", ex.getMessage());
+ }
+ }
+
+ public void testMissingMapping() throws Exception {
+ SDOUtil.registerStaticTypes(CustomerFactory.class);
+ DAS das = DAS.FACTORY.createDAS(getConfig("staticCustomer.xml"), getConnection());
+ Command readCustomers = das.createCommand("select * from CUSTOMER where ID = 1");
+
+ try {
+ readCustomers.executeQuery();
+
+ fail("Exception should be thrown");
+ } catch (RuntimeException ex) {
+ assertEquals("An SDO Type with name CUSTOMER was not found", ex.getMessage());
+ }
+
+ }
+
+ /**
+ * Test ability to describe problem when a user passes an empty stream
+ */
+ public void testEmptyStream() throws Exception {
+ try {
+ DAS.FACTORY.createDAS(getConfig("NonExistingFile.xml"));
+ fail("Error should be thrown");
+ } catch (RuntimeException e) {
+ assertEquals(
+ "Cannot load configuration from a null InputStream. Possibly caused by an incorrect config xml file name",
+ e.getMessage());
+ }
+ }
+
+ /**
+ * Test ability to describe problem when a user passes an empty stream
+ */
+ public void testEmptyStream2() throws Exception {
+ try {
+ DAS.FACTORY.createDAS(getConfig("NonExistingFile.xml"));
+ fail("Error should be thrown");
+ } catch (RuntimeException e) {
+ assertEquals(
+ "Cannot load configuration from a null InputStream. Possibly caused by an incorrect config xml file name",
+ e.getMessage());
+ }
+ }
+
+
+ public void testReadOrdersAndDetails2() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("InvalidConfig1.xml"), getConnection());
+ Command read = das
+ .createCommand(
+ "SELECT * FROM ANORDER LEFT JOIN ORDERDETAILS ON ANORDER.ID = ORDERDETAILS.ORDERID ORDER BY ANORDER.ID");
+
+ try {
+ read.executeQuery();
+ } catch ( Exception ex ) {
+ assertEquals("The parent table (xxx) in relationship ORDERDETAILS was not found.", ex.getMessage());
+ }
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedCommandTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedCommandTests.java
new file mode 100644
index 0000000000..278c4de1ee
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedCommandTests.java
@@ -0,0 +1,92 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+import java.util.List;
+
+import org.apache.tuscany.das.rdb.test.commands.ReadCustomersByLastnameCommand;
+import org.apache.tuscany.das.rdb.test.commands.ReadCustomersCommand;
+import org.apache.tuscany.das.rdb.test.commands.ReadCustomersStaticTypesCommand;
+import org.apache.tuscany.das.rdb.test.commands.ReadCustomersWithShapeCommand;
+import org.apache.tuscany.das.rdb.test.commands.SimpleReadCustomersWithShapeCommand;
+import org.apache.tuscany.das.rdb.test.customer.Customer;
+import org.apache.tuscany.das.rdb.test.data.CustomerData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+public class GeneratedCommandTests extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ new CustomerData(getAutoConnection()).refresh();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testReadCustomers() throws Exception {
+ ReadCustomersCommand cmd = new ReadCustomersCommand();
+ cmd.setConnection(getConnection());
+
+ DataObject root = cmd.executeQuery();
+ assertEquals(5, root.getList("CUSTOMER").size());
+ }
+
+ public void testReadSomeCustomers() throws Exception {
+ ReadCustomersByLastnameCommand cmd = new ReadCustomersByLastnameCommand();
+ cmd.setConnection(getConnection());
+ cmd.setParameter(1, "Williams");
+
+ DataObject root = cmd.executeQuery();
+ assertEquals(4, root.getList("CUSTOMER").size());
+
+ }
+
+ public void testReadCustomersStaticTypes() throws Exception {
+ ReadCustomersStaticTypesCommand cmd = new ReadCustomersStaticTypesCommand();
+ cmd.setConnection(getConnection());
+ cmd.setParameter(1, "Williams");
+
+ DataObject root = cmd.executeQuery();
+
+ List customers = root.getList("Customer");
+ assertEquals(4, customers.size());
+
+ Customer cust1 = (Customer) customers.get(0);
+ assertEquals("Williams", cust1.getLastName());
+
+ }
+
+ public void testSimpleReadCustomersWithShape() throws Exception {
+ SimpleReadCustomersWithShapeCommand cmd = new SimpleReadCustomersWithShapeCommand();
+ cmd.setConnection(getConnection());
+ DataObject root = cmd.executeQuery();
+ assertEquals(5, root.getList("CUSTOMER").size());
+ }
+
+ public void testReadCustomersOrdersWithShape() throws Exception {
+ ReadCustomersWithShapeCommand cmd = new ReadCustomersWithShapeCommand();
+ cmd.setConnection(getConnection());
+
+ DataObject root = cmd.executeQuery();
+ assertEquals(5, root.getList("CUSTOMER").size());
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedId.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedId.java
new file mode 100644
index 0000000000..4ecb166a10
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedId.java
@@ -0,0 +1,262 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+/*
+ * Generated IDs
+ *
+ *
+ */
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.data.CompanyData;
+import org.apache.tuscany.das.rdb.test.data.DepartmentData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+public class GeneratedId extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ new CompanyData(getAutoConnection()).refresh();
+ new DepartmentData(getAutoConnection()).refresh();
+
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ // Test insert into row with generated ID
+ public void testInsert() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command insert = das.createCommand("insert into COMPANY (NAME) values (?)");
+ insert.setParameter(1, "AAA Rental");
+ insert.execute();
+
+ // Verify insert
+ // Verify
+ Command select = das.createCommand("Select ID, NAME from COMPANY");
+ DataObject root = select.executeQuery();
+
+ assertEquals(4, root.getList("COMPANY").size());
+ assertTrue(root.getInt("COMPANY[1]/ID") > 0);
+
+ }
+
+ // Test back to back insertions with the same command
+ public void testInsert2() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command insert = das.createCommand("insert into COMPANY (NAME) values (?)");
+ insert.setParameter(1, "AAA Rental");
+ insert.execute();
+
+ // insert another using same command
+ insert.setParameter(1, "BBB Rental");
+ insert.execute();
+
+ // Verify insert
+ // Verify
+ Command select = das.createCommand("Select ID, NAME from COMPANY");
+ DataObject root = select.executeQuery();
+
+ assertEquals(5, root.getList("COMPANY").size());
+
+ }
+
+ // Test ability to retrieve and utilize the generated key
+ public void testInsert3() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command insert = das.createCommand("insert into COMPANY (NAME) values (?)");
+ insert.setParameter(1, "AAA Rental");
+ insert.execute();
+// Integer key = (Integer) insert.getParameterValue("generated_key");
+ Integer key = (Integer) insert.getGeneratedKey();
+
+ // Verify insert
+ Command select = das.createCommand("Select ID, NAME from COMPANY where ID = ?");
+ select.setParameter(1, key);
+ DataObject root = select.executeQuery();
+ assertEquals(key, root.get("COMPANY[1]/ID"));
+
+ }
+
+ // Test ability to propogate generated values back to owning data objects
+ public void testPropagateIds() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"), getConnection());
+ Command select = das.getCommand("all companies");
+ DataObject root = select.executeQuery();
+
+ // Create a new Company
+ DataObject company = root.createDataObject("COMPANY");
+ company.setString("NAME", "Do-rite Pest Control");
+
+ // verify pre-condition (id is not there until after flush)
+ assertNull(company.get("ID"));
+
+ // Flush changes
+ das.applyChanges(root);
+
+ // Save the id
+ Integer id = (Integer) company.get("ID");
+
+ // Verify the change
+ select = das.createCommand("Select * from COMPANY where ID = ?");
+ select.setParameter(1, id);
+ root = select.executeQuery();
+ assertEquals("Do-rite Pest Control", root.getDataObject("COMPANY[1]").getString("NAME"));
+
+ }
+
+ /**
+ * Same as above but metadata provided by XML config file
+ */
+ public void testPropagateIdsXML() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConfig("basicCompanyMapping.xml"), getConnection());
+ Command select = das.createCommand("Select * from COMPANY");
+ DataObject root = select.executeQuery();
+
+ // Create a new Company
+ DataObject company = root.createDataObject("COMPANY");
+ company.setString("NAME", "Do-rite Pest Control");
+
+
+ // verify pre-condition (id is not there until after flush)
+ assertNull(company.get("ID"));
+
+ // Flush changes
+ das.applyChanges(root);
+
+ // Save the id
+ Integer id = (Integer) company.get("ID");
+
+ // Verify the change
+ select = das.createCommand("Select * from COMPANY where ID = ?");
+ select.setParameter(1, id);
+ root = select.executeQuery();
+ assertEquals("Do-rite Pest Control", root.getDataObject("COMPANY[1]").getString("NAME"));
+
+ }
+
+ /**
+ * Test ability to correctly flush heirarchy of objects that have generated
+ * keys
+ */
+ public void testFlushCreateHeirarchy() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("basicCompanyDepartmentMapping.xml"), getConnection());
+ String selectCompanys = "SELECT * FROM COMPANY LEFT JOIN DEPARTMENT ON COMPANY.ID = DEPARTMENT.COMPANYID";
+
+ Command select = das.createCommand(selectCompanys);
+ DataObject root = select.executeQuery();
+
+ // Create a new Company
+ DataObject company = root.createDataObject("COMPANY");
+ company.setString("NAME", "Do-rite Pest Control");
+
+ // Create a new Department
+ // Do not set ID or CompanyID since these are generated
+ // ID INT, NAME VARCHAR(30), LOCATION VARCHAR(30), NUMBER VARCHAR(10),
+ // COMPANYID INT, EOTM INT
+ DataObject department = root.createDataObject("DEPARTMENT");
+ department.setString("NAME", "Do-rite Pest Control");
+ department.setString("LOCATION", "The boonies");
+ department.setString("NUMBER", "101");
+
+ // Associate the new department with the new company
+ company.getList("departments").add(department);
+
+ das.applyChanges(root);
+
+ // Save the id
+ Integer id = (Integer) company.get("ID");
+
+ // Verify the change
+ String selectString = "SELECT * FROM COMPANY LEFT JOIN DEPARTMENT ON COMPANY.ID = DEPARTMENT.COMPANYID WHERE COMPANY.ID = ?";
+
+ select = das.createCommand(selectString);
+ select.setParameter(1, id);
+ root = select.executeQuery();
+ assertEquals("Do-rite Pest Control", root.getDataObject("COMPANY[1]").getString("NAME"));
+
+ }
+
+ /**
+ * Test ability to correctly flush heirarchy of objects that have generated
+ * keys even when a created object has legal but NULL property values
+ */
+ public void testFlushCreateHeirarchy2() throws Exception {
+
+ String selectCompanys = "SELECT * FROM COMPANY LEFT JOIN DEPARTMENT ON COMPANY.ID = DEPARTMENT.COMPANYID";
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("basicCompanyDepartmentMapping.xml"), getConnection());
+ Command select = das.createCommand(selectCompanys);
+ DataObject root = select.executeQuery();
+
+ // Create a new Company
+ DataObject company = root.createDataObject("COMPANY");
+ company.setString("NAME", "Do-rite Pest Control");
+
+ // Create a new Department
+ // Do not set ID or CompanyID since these are generated
+ // ID INT, NAME VARCHAR(30), LOCATION VARCHAR(30), NUMBER VARCHAR(10),
+ // COMPANYID INT, EOTM INT
+ DataObject department = root.createDataObject("DEPARTMENT");
+ department.setString("NAME", "Do-rite Pest Control");
+ // Do not set this property to force storing NULL to DB
+ // department.setString("LOCATION", "The boonies");
+ department.setString("NUMBER", "101");
+
+ // Associate the new department with the new company
+ company.getList("departments").add(department);
+
+ das.applyChanges(root);
+
+ // Save the id
+ Integer id = (Integer) company.get("ID");
+
+ // Verify the change
+ String selectString = "SELECT * FROM COMPANY LEFT JOIN DEPARTMENT ON COMPANY.ID = DEPARTMENT.COMPANYID WHERE COMPANY.ID = ?";
+
+ select = das.createCommand(selectString);
+ select.setParameter(1, id);
+ root = select.executeQuery();
+ assertEquals("Do-rite Pest Control", root.getDataObject("COMPANY[1]").getString("NAME"));
+
+ }
+
+ // Test that error is thrown when no key has been generated (as in a select)
+ public void testRead() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command select = das.createCommand("Select * from COMPANY");
+ select.executeQuery();
+
+ try {
+ select.getGeneratedKey();
+ fail("Should throw exception");
+ } catch (RuntimeException e) {
+ assertEquals("This method is only valid for insert commands", e.getMessage());
+ }
+ }
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GraphMergeTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GraphMergeTests.java
new file mode 100644
index 0000000000..e1acf327f3
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GraphMergeTests.java
@@ -0,0 +1,150 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+import java.util.ArrayList;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.merge.impl.GraphMerger;
+import org.apache.tuscany.das.rdb.test.data.CustomerData;
+import org.apache.tuscany.das.rdb.test.data.OrderData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+public class GraphMergeTests extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ new CustomerData(getAutoConnection()).refresh();
+ new OrderData(getAutoConnection()).refresh();
+
+ }
+
+
+ public void testSingleTableMerge() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command select = das
+ .createCommand("Select ID, LASTNAME, ADDRESS from CUSTOMER where ID <= ?");
+ select.setParameter(1, "3");
+ DataObject graph1 = select.executeQuery();
+ assertEquals(3, graph1.getList("CUSTOMER").size());
+
+ select.setParameter(1, "5");
+ DataObject graph2 = select.executeQuery();
+ assertEquals(5, graph2.getList("CUSTOMER").size());
+
+ GraphMerger merger = new GraphMerger();
+ merger.addPrimaryKey("CUSTOMER.ID");
+ DataObject mergedGraph = merger.merge(graph1, graph2);
+
+ assertEquals(5, mergedGraph.getList("CUSTOMER").size());
+ }
+
+ public void testSingleTableMergeThreeGraphs() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command select = das
+ .createCommand("Select ID, LASTNAME, ADDRESS from CUSTOMER where ID <= ?");
+ select.setParameter(1, "3");
+ DataObject graph1 = select.executeQuery();
+ assertEquals(3, graph1.getList("CUSTOMER").size());
+
+ select.setParameter(1, "4");
+ DataObject graph2 = select.executeQuery();
+ assertEquals(4, graph2.getList("CUSTOMER").size());
+
+ select.setParameter(1, "5");
+ DataObject graph3 = select.executeQuery();
+ assertEquals(5, graph3.getList("CUSTOMER").size());
+
+ GraphMerger merger = new GraphMerger();
+ merger.addPrimaryKey("CUSTOMER.ID");
+ ArrayList graphs = new ArrayList();
+ graphs.add(graph1);
+ graphs.add(graph2);
+ graphs.add(graph3);
+ DataObject mergedGraph = merger.merge(graphs);
+
+ assertEquals(5, mergedGraph.getList("CUSTOMER").size());
+
+ }
+
+
+ public void testMultiTableMerge2() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConfig("CustomersOrdersConfig.xml"), getConnection());
+ //Read some customers and related orders
+ Command select = das.createCommand(
+ "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = ?");
+
+ select.setParameter(1, new Integer(1));
+ DataObject graph1 = select.executeQuery();
+
+ DataObject customer = (DataObject)graph1.getList("CUSTOMER").get(0);
+ assertEquals(2, customer.getList("orders").size());
+
+ select.setParameter(1, new Integer(2));
+ DataObject graph2 = select.executeQuery();
+ DataObject customer2 = (DataObject)graph2.getList("CUSTOMER").get(0);
+ assertEquals(1, graph2.getList("CUSTOMER").size());
+ assertEquals(1, customer2.getList("orders").size());
+ assertEquals(2, customer2.getInt("ID"));
+
+ GraphMerger merger = new GraphMerger();
+ merger.addPrimaryKey("CUSTOMER.ID");
+ merger.addPrimaryKey("ANORDER.ID");
+ DataObject mergedGraph = merger.merge(graph1, graph2);
+
+ assertEquals(3, mergedGraph.getList("ANORDER").size());
+ assertEquals(2, mergedGraph.getList("CUSTOMER").size());
+
+ DataObject mergedCustomer = (DataObject) mergedGraph.getList("CUSTOMER").get(1);
+ assertEquals(2, mergedCustomer.getInt("ID"));
+ assertEquals(1, mergedCustomer.getList("orders").size());
+ DataObject mergedOrder = (DataObject) mergedCustomer.getList("orders").get(0);
+ assertEquals(4, mergedOrder.getInt("ID"));
+
+ }
+
+ public void testMultiTableAppendSingleTable2() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConfig("CustomersOrdersConfig.xml"), getConnection());
+ //Read some customers and related orders
+ Command select = das.createCommand(
+ "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = ?");
+
+ select.setParameter(1, new Integer(1));
+ DataObject graph1 = select.executeQuery();
+
+ DataObject customer = (DataObject)graph1.getList("CUSTOMER").get(0);
+ assertEquals(2, customer.getList("orders").size());
+
+ DAS das2 = DAS.FACTORY.createDAS(getConnection());
+ Command select2 = das2.createCommand("select * from ANORDER");
+ DataObject graph2 = select2.executeQuery();
+ assertEquals(4, graph2.getList("ANORDER").size());
+
+ GraphMerger merger = new GraphMerger();
+ merger.addPrimaryKey("CUSTOMER.ID");
+ merger.addPrimaryKey("ANORDER.ID");
+ DataObject mergedGraph = merger.merge(graph1, graph2);
+ assertEquals(4, mergedGraph.getList("ANORDER").size());
+ assertEquals(1, mergedGraph.getList("CUSTOMER").size());
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/NameMappingTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/NameMappingTests.java
new file mode 100644
index 0000000000..fed25abdb9
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/NameMappingTests.java
@@ -0,0 +1,65 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+/*
+ *
+ *
+ */
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.data.CustomerData;
+import org.apache.tuscany.das.rdb.test.data.OrderData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+
+public class NameMappingTests extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ new CustomerData(getAutoConnection()).refresh();
+ new OrderData(getAutoConnection()).refresh();
+
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Test ability to assign DataObject type and propertyaliases with xml file
+ */
+ public void testRead() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("customerMapping.xml"), getConnection());
+ // Read a customer
+ Command select = das.createCommand(
+ "SELECT * FROM CUSTOMER WHERE CUSTOMER.ID = 1");
+
+ DataObject root = select.executeQuery();
+ DataObject customer = root.getDataObject("Customer[1]");
+ assertEquals(1, customer.getInt("id"));
+ assertEquals("1212 foobar lane", customer.getString("address"));
+ assertEquals("Williams", customer.getString("lastname"));
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OCCTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OCCTests.java
new file mode 100644
index 0000000000..5ff387ed8b
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OCCTests.java
@@ -0,0 +1,102 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.data.BookData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+public class OCCTests extends DasTest {
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ new BookData(getAutoConnection()).refresh();
+ }
+
+
+ public void testSimpleOCC() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("BooksConfig.xml"), getConnection());
+ //Read a book instance
+ Command select = das.getCommand("select book 1");
+ DataObject root = select.executeQuery();
+ DataObject book = root.getDataObject("BOOK[1]");
+ //Change a field to mark the instance 'dirty'
+ book.setInt("QUANTITY", 2);
+
+ // Explicitly change OCC column in database to force collision
+ Command update = das.getCommand("update book 1");
+ update.setParameter(1, new Integer(100));
+ update.execute();
+
+ //Try to apply changes and catch the expected OCC Exception
+ try {
+ das.applyChanges(root);
+ fail("An OCCException should be thrown");
+ } catch (RuntimeException ex) {
+ if ( !ex.getMessage().equals("OCC Exception") )
+ throw ex;
+ }
+ }
+
+ public void testManagedOCC() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConfig("ManagedBooksConfig.xml"), getConnection());
+ Command select = das.getCommand("select book 1");
+ DataObject root = select.executeQuery();
+ DataObject book = root.getDataObject("BOOK[1]");
+ //Change a field to mark the instance 'dirty'
+ book.setInt("QUANTITY", 2);
+ int occValue = book.getInt("OCC");
+ das.applyChanges(root);
+
+ root = select.executeQuery();
+ book = root.getDataObject("BOOK[1]");
+ assertEquals(occValue + 1, book.getInt("OCC"));
+ }
+
+ public void testManagedOCCFailure() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConfig("ManagedBooksConfig.xml"), getConnection());
+ //Read a book instance
+ Command select = das.getCommand("select book 1");
+ DataObject root = select.executeQuery();
+ DataObject book = root.getDataObject("BOOK[1]");
+ //Change a field to mark the instance 'dirty'
+ book.setInt("QUANTITY", 2);
+
+
+ DAS das2 = DAS.FACTORY.createDAS(getConfig("ManagedBooksConfig.xml"), getConnection());
+ //Read a book instance
+ Command select2= das2.getCommand("select book 1");
+ DataObject root2 = select2.executeQuery();
+ DataObject book2 = root2.getDataObject("BOOK[1]");
+ //Change a field to mark the instance 'dirty'
+ book2.setInt("QUANTITY", 5);
+ das2.applyChanges(root2);
+
+ //Try to apply changes and catch the expecetd OCC Exception
+ try {
+ das.applyChanges(root);
+ fail("An OCCException should be thrown");
+ } catch (RuntimeException ex) {
+ if ( !ex.getMessage().equals("OCC Exception") )
+ throw ex;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OneToOneRelationshipTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OneToOneRelationshipTests.java
new file mode 100644
index 0000000000..3039f4778e
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OneToOneRelationshipTests.java
@@ -0,0 +1,155 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.data.CompanyData;
+import org.apache.tuscany.das.rdb.test.data.CompanyEmpData;
+import org.apache.tuscany.das.rdb.test.data.EmployeeData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+public class OneToOneRelationshipTests extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ new CompanyData(getAutoConnection()).refresh();
+ new EmployeeData(getAutoConnection()).refresh();
+ new CompanyEmpData(getAutoConnection()).refresh();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+
+ /**
+ * Read Company and traverse to EOTM
+ */
+ public void test1() throws Exception {
+
+ DAS das = DAS.FACTORY
+ .createDAS(getConfig("CompanyEmployeeConfig.xml"), getConnection());
+
+ Command read = das.getCommand("get companies with employee of the month");
+ DataObject root = read.executeQuery();
+ DataObject employee = root.getDataObject("COMPANY[1]/company->employee_opposite");
+
+ assertEquals("Mary Smith", employee.getString("NAME"));
+ }
+
+
+ /**
+ * Read Employee and traverse to Company
+ */
+ public void test2() throws Exception {
+
+ DAS das = DAS.FACTORY
+ .createDAS(getConfig("CompanyEmployeeConfig.xml"), getConnection());
+
+ Command read = das.getCommand("get named employee with company");
+ read.setParameter(1, "Mary Smith");
+ DataObject root = read.executeQuery();
+ DataObject company = root.getDataObject("EMPLOYEE[1]/company->employee");
+
+ assertEquals("ACME Publishing", company.getString("NAME"));
+ }
+
+
+ /**
+ * Un-assign employee O' month
+ */
+ public void test3() throws Exception {
+
+ DAS das = DAS.FACTORY
+ .createDAS(getConfig("CompanyEmployeeConfig.xml"), getConnection());
+
+ Command read = das.getCommand("get companies with employee of the month");
+ DataObject root = read.executeQuery();
+ DataObject company = root.getDataObject("COMPANY[1]");
+ company.setDataObject("company->employee_opposite", null);
+ assertNull(company.getDataObject("company->employee_opposite"));
+
+ //Flush changes
+ das.applyChanges(root);
+
+ //Verify
+ root = read.executeQuery();
+ company = root.getDataObject("COMPANY[1]");
+ assertNull(company.getDataObject("company->employee_opposite"));
+ }
+
+ /**
+ * Delete employee O' month
+ */
+ public void test4() throws Exception {
+
+ DAS das = DAS.FACTORY
+ .createDAS(getConfig("CompanyEmployeeConfig.xml"), getConnection());
+
+ Command read = das.getCommand("get companies with employee of the month");
+ DataObject root = read.executeQuery();
+ DataObject company = root.getDataObject("COMPANY[1]");
+ DataObject employee = company.getDataObject("company->employee_opposite");
+ employee.delete();
+ assertNull(company.getDataObject("company->employee_opposite"));
+
+ //Flush changes
+ das.applyChanges(root);
+
+ //Verify
+ root = read.executeQuery();
+ company = root.getDataObject("COMPANY[1]");
+ assertNull(company.getDataObject("company->employee_opposite"));
+ }
+
+ /**
+ * Add new employee O' month
+ */
+ public void test5() throws Exception {
+
+ DAS das = DAS.FACTORY
+ .createDAS(getConfig("CompanyEmployeeConfig.xml"), getConnection());
+
+ Command read = das.getCommand("get companies with employee of the month");
+ DataObject root = read.executeQuery();
+ DataObject company = root.getDataObject("COMPANY[1]");
+
+ //Create a new employee
+ DataObject employee = root.createDataObject("EMPLOYEE");
+ employee.setString ("NAME", "Joe Hotshot");
+
+ //Assigne a EOTM
+ //Strangely this statement results in "Could not find relationships" error
+ //although "company.setDataObject("company->employee_opposite", null);" dos not
+ company.setDataObject("company->employee_opposite", employee);
+
+ //Flush changes
+ das.applyChanges(root);
+
+ //Verify
+ root = read.executeQuery();
+ company = root.getDataObject("COMPANY[1]");
+
+ employee = root.getDataObject("COMPANY[1]/company->employee_opposite");
+
+ assertEquals("Joe Hotshot", employee.getString("NAME"));
+
+ }
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OperationOrderingTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OperationOrderingTests.java
new file mode 100644
index 0000000000..7c2d15efe7
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OperationOrderingTests.java
@@ -0,0 +1,78 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.data.CityData;
+import org.apache.tuscany.das.rdb.test.data.StateData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+public class OperationOrderingTests extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ CityData city = new CityData(getAutoConnection());
+ StateData state = new StateData(getAutoConnection());
+
+ city.doDeletes();
+ state.doDeletes();
+ state.doInserts();
+ city.doInserts();
+
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public OperationOrderingTests() {
+ super();
+ }
+
+ public void testInsert() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConfig("cityStates.xml"), getConnection());
+ Command select = das
+ .createCommand(
+ "Select * from STATES inner join CITIES on STATES.ID = CITIES.STATE_ID");
+ DataObject root = select.executeQuery();
+
+ int numberOfStates = root.getList("STATES").size();
+ int numberOfCities = root.getList("CITIES").size();
+
+ DataObject atlanta = root.createDataObject("CITIES");
+ atlanta.setString("NAME", "Atlanta");
+ atlanta.setInt("ID", 6);
+
+ // Create a new Company
+ DataObject georgia = root.createDataObject("STATES");
+ georgia.setInt("ID", 4);
+ georgia.setString("NAME", "GA");
+
+ georgia.getList("cities").add(atlanta);
+
+ das.applyChanges(root);
+
+ root = select.executeQuery();
+ assertEquals(numberOfCities + 1, root.getList("CITIES").size());
+ assertEquals(numberOfStates + 1, root.getList("STATES").size());
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/Paging.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/Paging.java
new file mode 100644
index 0000000000..3358344f71
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/Paging.java
@@ -0,0 +1,105 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+
+import java.sql.SQLException;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.Pager;
+import org.apache.tuscany.das.rdb.impl.PagerImpl;
+import org.apache.tuscany.das.rdb.test.data.CustomerData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+
+
+public class Paging extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ new CustomerData(getAutoConnection()).refresh();
+ }
+
+ public void testPaging() throws SQLException {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ //Build command to read all customers
+ Command custCommand = das.createCommand("select * from CUSTOMER order by ID");
+
+ //Create a pager with the command
+ Pager pager = new PagerImpl(custCommand, 2);
+
+ //Get and work with first page
+ DataObject root = pager.next();
+ DataObject customer1 = root.getDataObject("CUSTOMER[1]");
+ DataObject customer2 = root.getDataObject("CUSTOMER[2]");
+ assertEquals(1, customer1.getInt("ID"));
+ assertEquals(2, customer2.getInt("ID"));
+
+ //Get and work with the second page
+ root = pager.next();
+ customer1 = root.getDataObject("CUSTOMER[1]");
+ customer2 = root.getDataObject("CUSTOMER[2]");
+ assertEquals(3, customer1.getInt("ID"));
+ assertEquals(4, customer2.getInt("ID"));
+
+ // First page again
+ root = pager.previous();
+ customer1 = root.getDataObject("CUSTOMER[1]");
+ customer2 = root.getDataObject("CUSTOMER[2]");
+ assertEquals(1, customer1.getInt("ID"));
+ assertEquals(2, customer2.getInt("ID"));
+
+ }
+
+
+ public void testRandomPage() throws SQLException {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ //Build the select command
+ Command select = das
+ .createCommand("select * from CUSTOMER order by ID");
+
+ //Create a pager
+ Pager pager = new PagerImpl(select, 2);
+
+ //Get the first page
+ DataObject root = pager.getPage(1);
+ DataObject customer1 = root.getDataObject("CUSTOMER[1]");
+ DataObject customer2 = root.getDataObject("CUSTOMER[2]");
+ assertEquals(1, customer1.getInt("ID"));
+ assertEquals(2, customer2.getInt("ID"));
+
+ //Get the second page
+ root = pager.getPage(2);
+ customer1 = root.getDataObject("CUSTOMER[1]");
+ customer2 = root.getDataObject("CUSTOMER[2]");
+ assertEquals(3, customer1.getInt("ID"));
+ assertEquals(4, customer2.getInt("ID"));
+
+
+ // Get the first page again
+ root = pager.getPage(1);
+ customer1 = root.getDataObject("CUSTOMER[1]");
+ customer2 = root.getDataObject("CUSTOMER[2]");
+ assertEquals(1, customer1.getInt("ID"));
+ assertEquals(2, customer2.getInt("ID"));
+ }
+
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PartialUpdateTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PartialUpdateTests.java
new file mode 100644
index 0000000000..84e2813c22
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PartialUpdateTests.java
@@ -0,0 +1,97 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+import java.sql.SQLException;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.data.CustomerData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+public class PartialUpdateTests extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ new CustomerData(getAutoConnection()).refresh();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public PartialUpdateTests() {
+ super();
+ }
+
+ public void testPartialUpdate() throws SQLException {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command readCustomers = das.createCommand("select * from CUSTOMER where ID = 1");
+
+ // Read
+ DataObject root = readCustomers.executeQuery();
+
+ DataObject customer = root.getDataObject("CUSTOMER[1]");
+ // Verify
+ assertEquals(1, customer.getInt("ID"));
+
+ Command update = das.createCommand("update CUSTOMER set LASTNAME = 'modified' where ID = 1");
+ update.execute();
+
+ customer.setString("ADDRESS", "main street");
+
+ das.applyChanges(root);
+
+ root = readCustomers.executeQuery();
+
+ // If partial update was not used, LASTNAME would not be 'modified'
+ customer = root.getDataObject("CUSTOMER[1]");
+ assertEquals(1, customer.getInt("ID"));
+ assertEquals("modified", customer.getString("LASTNAME"));
+ assertEquals("main street", customer.getString("ADDRESS"));
+ }
+
+ public void testPartialInsert() throws SQLException {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command readCustomers = das.createCommand("select * from CUSTOMER where ID = 1");
+
+ // Read
+ DataObject root = readCustomers.executeQuery();
+
+ // Create a new customer
+ DataObject newCust = root.createDataObject("CUSTOMER");
+ newCust.set("ID", new Integer(100));
+ newCust.set("ADDRESS", "5528 Wells Fargo Drive");
+ // Purposely do not set lastname to let it default to 'Garfugengheist'
+ // newCust.set("LASTNAME", "Gerkin" );
+
+ das.applyChanges(root);
+
+ Command readNewCust = das.createCommand("select * from CUSTOMER where ID = 100");
+ root = readNewCust.executeQuery();
+
+ // If partial insert was not used, LASTNAME would not be
+ // 'Garfugengheist'
+ newCust = root.getDataObject("CUSTOMER[1]");
+ assertEquals(100, newCust.getInt("ID"));
+ assertEquals("Garfugengheist", newCust.getString("LASTNAME"));
+ assertEquals("5528 Wells Fargo Drive", newCust.getString("ADDRESS"));
+
+ }
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PassiveConnectionTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PassiveConnectionTests.java
new file mode 100644
index 0000000000..a9fdaa1467
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PassiveConnectionTests.java
@@ -0,0 +1,92 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+/*
+ * Test capability to participate in an extenrlly managed transaction. The
+ * client is managing the transaction boundary so the DAS will not issue
+ * commit/rollback
+ *
+ */
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.data.CustomerData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+public class PassiveConnectionTests extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ new CustomerData(getAutoConnection()).refresh();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Read and modify a customer. Uses a "passive" connection
+ */
+ public void testReadModifyApply() throws Exception {
+
+ // Create and initialize a DAS connection and initialize for externally
+ // managed transaction boundaries
+ java.sql.Connection c = getConnection();
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("passiveConnection.xml"), c);
+ // Read customer 1
+ Command select = das.getCommand("get a customer");
+ DataObject root = select.executeQuery();
+
+ DataObject customer = (DataObject) root.get("CUSTOMER[1]");
+
+ String lastName = customer.getString("LASTNAME");
+
+ // Modify customer
+ customer.set("LASTNAME", "Pavick");
+
+ try {
+ das.applyChanges(root);
+
+ throw new Exception("Test Exception");
+
+ // Since the DAS is not managing tx boundaries, I must
+ } catch (Exception e) {
+ // assert here to make sure we didn't run into some hidden error
+ assertEquals("Test Exception", e.getMessage());
+ // Roll back the transaction
+ c.rollback();
+ }
+
+ // Verify that the changes did not go through
+ root = select.executeQuery();
+ assertEquals(lastName, root.getString("CUSTOMER[1]/LASTNAME"));
+
+ // Try again
+ customer = (DataObject) root.get("CUSTOMER[1]");
+ customer.set("LASTNAME", "Pavick");
+ das.applyChanges(root);
+ c.commit();
+
+ root = select.executeQuery();
+ assertEquals("Pavick", root.getString("CUSTOMER[1]/LASTNAME"));
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ProgrammaticConfigTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ProgrammaticConfigTests.java
new file mode 100644
index 0000000000..b61f871614
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ProgrammaticConfigTests.java
@@ -0,0 +1,146 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.ConfigHelper;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.data.BookData;
+import org.apache.tuscany.das.rdb.test.data.CustomerData;
+import org.apache.tuscany.das.rdb.test.data.OrderData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+/**
+ * Tests the Converter framwork
+ */
+public class ProgrammaticConfigTests extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ new BookData(getAutoConnection()).refresh();
+ new CustomerData(getAutoConnection()).refresh();
+ new OrderData(getAutoConnection()).refresh();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Simple read followed by a write. This should fail since there is no
+ * config associaed with the applychanges command
+ */
+ public void test_1() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ // Read a book instance
+ Command select = das.createCommand("SELECT * FROM BOOK WHERE BOOK_ID = 1");
+ DataObject root = select.executeQuery();
+ DataObject book = root.getDataObject("BOOK[1]");
+ // Change a field to mark the instance 'dirty'
+ book.setInt("QUANTITY", 2);
+
+ try {
+ das.applyChanges(root);
+ fail("An exception should be thrown since here is no config to identify the primary key");
+ } catch (RuntimeException ex) {
+ // Expected
+ }
+ }
+
+ /**
+ * Simple read followed by a write. Config instance is generated
+ * programmatically using the ConfigHelper.
+ */
+ public void test_2() throws Exception {
+ // Create config programmatically
+ ConfigHelper helper = new ConfigHelper();
+ helper.addPrimaryKey("BOOK.BOOK_ID");
+ DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection());
+
+ // Read a book instance
+ Command select = das.createCommand("SELECT * FROM BOOK WHERE BOOK_ID = 1");
+ DataObject root = select.executeQuery();
+ DataObject book = root.getDataObject("BOOK[1]");
+ // Change a field to mark the instance 'dirty'
+ book.setInt("QUANTITY", 2);
+
+ // Flush the change
+
+ das.applyChanges(root);
+
+ // Verify
+ root = select.executeQuery();
+ book = root.getDataObject("BOOK[1]");
+ assertEquals(2, book.getInt("QUANTITY"));
+ }
+
+
+ /**
+ * Test ability to read a compound graph
+ */
+ public void test_3() throws Exception {
+
+ String statement = "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID WHERE CUSTOMER.ID = 1";
+
+ // Read some customers and related orders
+ // Create relationship config programmatically
+ ConfigHelper helper = new ConfigHelper();
+ helper.addRelationship("CUSTOMER.ID", "ANORDER.CUSTOMER_ID");
+ DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection());
+ Command select = das.createCommand(statement);
+
+ DataObject root = select.executeQuery();
+ DataObject customer = root.getDataObject("CUSTOMER[1]");
+
+ assertEquals(2, customer.getList("ANORDER").size());
+
+ }
+
+ /**
+ * Programatically create table config with "property" name
+ */
+ public void test_4() throws Exception {
+
+ String statement = "SELECT * FROM BOOK WHERE BOOK.BOOK_ID = ?";
+
+ // Create Table config programmatically
+ ConfigHelper helper = new ConfigHelper();
+ helper.addTable("BOOK", "Book");
+ helper.addPrimaryKey("Book.BOOK_ID");
+
+ DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection());
+ Command select = das.createCommand(statement);
+ select.setParameter(1, new Integer(1));
+
+ DataObject root = select.executeQuery();
+
+ DataObject newBook = root.createDataObject("Book");
+ newBook.setString("NAME", "Ant Colonies of the Old World");
+ newBook.setInt("BOOK_ID", 1001);
+ root.getList("Book").add(newBook);
+
+ das.applyChanges(root);
+
+ //Verify
+ select.setParameter(1, new Integer(1001));
+ root = select.executeQuery();
+ assertEquals("Ant Colonies of the Old World", root.getString("Book[1]/NAME"));
+
+ }
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ReadDBSchemaTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ReadDBSchemaTests.java
new file mode 100644
index 0000000000..5a0be1d6da
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ReadDBSchemaTests.java
@@ -0,0 +1,62 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+/*
+ * Test the ability to query Database schema(metadata) information using regular DAS APIs
+ * This is speciic to DB2
+ *
+ */
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+
+public class ReadDBSchemaTests extends DasTest {
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+
+
+ public void testReadTableInfo() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command select = das.createCommand("SELECT * from SYSIBM.SYSTABLES WHERE TYPE = 'T'");
+ DataObject root = select.executeQuery();
+
+ DataObject table = (DataObject)root.get("SYSTABLES[1]");
+
+ assertEquals('T', table.getChar("TYPE"));
+
+ }
+
+
+
+ //Utilities
+
+
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RecursiveTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RecursiveTests.java
new file mode 100644
index 0000000000..e851a4d925
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RecursiveTests.java
@@ -0,0 +1,69 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+import java.util.Iterator;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.data.PartData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+public class RecursiveTests extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ new PartData(getAutoConnection()).refresh();
+ }
+
+ public void testReadEngineParts() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("PartsConfig.xml"), getConnection());
+ //Table definition
+ //CREATE TABLE PART (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(50), QUANTITY INT, PARENT_ID INT );
+
+
+ Command select = das.getCommand("readEngineParts");
+
+ // Need to set the key explicitly. The aggregate of columns not working
+ // because of null values
+ DataObject root = select.executeQuery();
+
+ assertEquals(5, root.getList("PART").size());
+ // printList(root.getList("PART"));
+ DataObject engine = root.getDataObject("PART.0");
+ assertEquals("Engine", engine.getString("NAME"));
+
+ assertEquals(3, engine.getList("subparts").size());
+
+ DataObject piston = null;
+ Iterator i = engine.getList("subparts").iterator();
+ while ( i.hasNext() ) {
+ DataObject obj = (DataObject)i.next();
+ if ( obj.getString("NAME").equals("Piston"))
+ piston = obj;
+ }
+
+ assertEquals("Piston", piston.getString("NAME"));
+ assertEquals(1, piston.getList("subparts").size());
+ assertEquals("Piston Ring", piston.getDataObject("subparts.0").getString("NAME"));
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java
new file mode 100644
index 0000000000..679bdabd38
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java
@@ -0,0 +1,109 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+/*
+ *
+ *
+ */
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.data.CustomerData;
+import org.apache.tuscany.das.rdb.test.data.OrderData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+public class RelationshipTests extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ new CustomerData(getAutoConnection()).refresh();
+ new OrderData(getAutoConnection()).refresh();
+
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Test ability to read a compound graph
+ */
+ public void testRead() throws Exception {
+
+ String statement = "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID WHERE CUSTOMER.ID = 1";
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("customerOrderRelationshipMapping.xml"), getConnection());
+ // Read some customers and related orders
+ Command select = das.createCommand(statement);
+
+ DataObject root = select.executeQuery();
+ DataObject customer = root.getDataObject("CUSTOMER[1]");
+
+ assertEquals(2, customer.getList("orders").size());
+
+ }
+
+ /**
+ * Same as above except uses xml file for relationhip and key information.
+ * Employs CUD generation.
+ */
+ public void testRelationshipModification2() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("basicCustomerOrderMapping.xml"), getConnection());
+ // Read some customers and related orders
+ Command select = das
+ .createCommand("SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID");
+
+ DataObject root = select.executeQuery();
+
+ DataObject cust1 = root.getDataObject("CUSTOMER[1]");
+ DataObject cust2 = root.getDataObject("CUSTOMER[2]");
+
+ // Save IDs
+ Integer cust1ID = (Integer) cust1.get("ID");
+ Integer cust2ID = (Integer) cust2.get("ID");
+ // save order count
+ Integer cust1OrderCount = new Integer(cust1.getList("orders").size());
+ Integer cust2OrderCount = new Integer(cust2.getList("orders").size());
+
+ // Move an order to cust1 from cust2
+ DataObject order = (DataObject) cust2.getList("orders").get(0);
+ cust1.getList("orders").add(order);
+
+ // Flush changes
+ das.applyChanges(root);
+
+ // verify cust1 relationship updates
+ select = das
+ .createCommand("SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = ?");
+ select.setParameter(1, cust1ID);
+
+ root = select.executeQuery();
+ assertEquals(cust1OrderCount.intValue() + 1, root.getList("CUSTOMER[1]/orders").size());
+
+ // verify cust2 relationship updates
+ select.setParameter(1, cust2ID);
+ root = select.executeQuery();
+ assertEquals(cust2OrderCount.intValue() - 1, root.getList("CUSTOMER[1]/orders").size());
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ResultSetShapeTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ResultSetShapeTests.java
new file mode 100644
index 0000000000..bf10e0f379
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ResultSetShapeTests.java
@@ -0,0 +1,91 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.data.CustomerData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+/**
+ * Test ability to specify format(shape) of the ResultSet. This is necessary
+ * when the JDBC driver in use does not provide adequate support for
+ * ResultSetMetadata. Also, we expect that specifying the result set shape will
+ * increase performance.
+ *
+ */
+public class ResultSetShapeTests extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ new CustomerData(getAutoConnection()).refresh();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Read a specific customer
+ */
+ public void testReadSingle() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("CustomerConfigWithIDConverter.xml"),getConnection());
+ // Create and initialize command to read customers
+ Command readCustomers = das.getCommand("literal");
+
+ // Read
+ DataObject root = readCustomers.executeQuery();
+
+ // Verify
+ assertEquals(5, root.getList("CUSTOMER").size());
+ assertEquals(99, root.getInt("CUSTOMER[1]/ID"));
+ assertEquals("Roosevelt", root.getString("CUSTOMER[1]/LASTNAME"));
+ assertEquals("1600 Pennsylvania Avenue", root.getString("CUSTOMER[1]/ADDRESS"));
+
+ }
+
+ /**
+ * Read a specific customer This duplicates the previous tests but does not
+ * provide the shape info. Since the select will not return valid metadata,
+ * this test is expected to fail
+ */
+ public void testReadSingleVerifyShapeUse() throws Exception {
+
+ // Using literals in the select forces invalid resultset metadata
+ String sqlString = "Select 99, 'Roosevelt', '1600 Pennsylvania Avenue' from customer";
+
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ // Create and initialize command to read customers
+ Command readCustomers = das.createCommand(sqlString);
+
+ // Read
+ DataObject root = readCustomers.executeQuery();
+
+ // Verify
+ try {
+ assertEquals(5, root.getList("CUSTOMER").size());
+ fail("Should fail since there will be no feature named CUSTOMER");
+ } catch (IllegalArgumentException e) {
+ // OK
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SerializationTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SerializationTests.java
new file mode 100644
index 0000000000..0089e6b569
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SerializationTests.java
@@ -0,0 +1,90 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+/*
+ * This class provides tests for all supported "types". The current plan is to
+ * use the Data type definitions provided in the SDO 2 specification. We must
+ * test the ability to use all of these types as well as different mapping from
+ * thse types to types used in the database. For example, a SDO Data Type
+ * "STRING", might be staored as a "TIMESTAMP" in DB2.
+ *
+ */
+
+import org.apache.tuscany.das.rdb.test.data.TypesData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+public class SerializationTests extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ new TypesData(getAutoConnection()).refresh();
+ }
+
+ /**
+ * Read various types.
+ */
+
+
+public void testReadandSerialize() throws Exception {
+ /** Currently failing because of TUSCANY-22
+ Command select = Command.FACTORY
+ .createCommand("Select * from TYPETEST where ID = 1");
+ select.setConnection(getConnection());
+ DataObject root = select.executeQuery();
+
+ DataObject obj = root.getDataObject("TYPETEST[1]");
+
+ assertTrue(obj.isSet("ID"));
+ assertTrue(obj.isSet("ATIMESTAMP"));
+ assertTrue(obj.isSet("ADECIMAL"));
+ assertTrue(obj.isSet("AFLOAT"));
+
+ //Java serilaization to file
+ FileOutputStream fos = null;
+ ObjectOutputStream out = null;
+ try {
+ fos = new FileOutputStream("serializedGraph.xml");
+ out = new ObjectOutputStream(fos);
+ out.writeObject(root);
+ out.flush();
+ } finally {
+ out.close();
+ fos.close();
+ }
+
+ //Reconstruct the graph
+ FileInputStream fis = null;
+ ObjectInputStream in = null;
+ DataObject root2;
+ try {
+ fis = new FileInputStream("serializedGraph.xml");
+ in = new ObjectInputStream(fis);
+ root2 = (DataObject) in.readObject();
+ } finally {
+ in.close();
+ fis.close();
+ }
+
+ assertEquals(1, root.getInt("TYPETEST[1]/ID"));
+ assertEquals(TypesData.getTimestamp(), (java.sql.Timestamp)root.get("TYPETEST[1]/ATIMESTAMP"));
+ assertEquals(1234567.89f, root2.getFloat("TYPETEST[1]/ADECIMAL"), .001);
+ assertEquals(1234567.89f, root2.getFloat("TYPETEST[1]/AFLOAT"), .001);
+
+ */
+ }
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SimplestCrud.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SimplestCrud.java
new file mode 100644
index 0000000000..0f6ce5c2c8
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SimplestCrud.java
@@ -0,0 +1,235 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+/*
+ * These are the simplest possible uses of the JDBC DAS. In this mode, the
+ * programming model is not much more than JDBC
+ *
+ * The assumptions for these tests are:
+ *
+ * Single type
+ * Client explicitly Read/Create/Update/Delete commands
+ * No O/R mapping metadata
+ * SDO change history is not used
+ * Dynamic DataObjects
+ * No specified graph model
+ *
+ *
+ */
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.data.CustomerData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+
+public class SimplestCrud extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ new CustomerData(getAutoConnection()).refresh();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Read a specific customer
+ */
+ public void testReadSingle() throws Exception {
+
+ //Create and initialize command to read customers
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command readCustomers = das.createCommand("select * from CUSTOMER where ID = 1");
+
+ //Read
+ DataObject root = readCustomers.executeQuery();
+
+ //Verify
+ assertEquals(1, root.getInt("CUSTOMER[1]/ID"));
+ }
+
+ /**
+ * Read a specific customer
+ */
+ public void testReadSingle2() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ //Create and initialize command to read customers
+ Command readCustomers = das.createCommand("select * from CUSTOMER where ID = 1");
+
+ //Read
+ DataObject root = readCustomers.executeQuery();
+
+ //Verify
+ assertEquals(1, root.getInt("CUSTOMER[1]/ID"));
+ }
+
+ /**
+ * Read a specific customer
+ * Same as above but tests tolerance of white space in provided SQL
+ */
+ public void testReadSingleWithWhiteSpace() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ //Create and initialize command to read customers
+ Command readCustomers = das.createCommand(" select * from CUSTOMER where ID = 1");
+
+ //Read
+ DataObject root = readCustomers.executeQuery();
+
+ //Verify
+ assertEquals(1, root.getInt("CUSTOMER[1]/ID"));
+ }
+
+ /**
+ * Read all customers with a specific last name
+ */
+ public void testReadMultiple() throws Exception {
+
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ //Create and initialize command to read customers
+ Command readCustomers = das.createCommand("select * from CUSTOMER where LASTNAME = 'Williams'");
+
+ //Read
+ DataObject root = readCustomers.executeQuery();
+
+ //Verify
+ assertEquals(4, root.getList("CUSTOMER").size());
+ }
+
+ /**
+ * Read all customers with a specific last name
+ * LASTNAME value is provided via a parameter
+ */
+ public void testReadMultipleWithParameters() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ //Create and initialize command to read customers
+ Command readCustomers = das.createCommand("select * from CUSTOMER where LASTNAME = ?");
+
+ //Parameterize the command
+ readCustomers.setParameter(1, "Williams");
+ DataObject root = readCustomers.executeQuery();
+
+ //Verify
+ assertEquals(4, root.getList("CUSTOMER").size());
+ }
+
+ public void testInsert() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command insert = das.createCommand("insert into CUSTOMER values (10, 'Williams', '5528 Wells Fargo Dr')");
+ insert.execute();
+
+ //Verify
+ Command select = das.createCommand("Select * from CUSTOMER where ID = 10");
+ DataObject root = select.executeQuery();
+ assertEquals(1, root.getList("CUSTOMER").size());
+ assertEquals("5528 Wells Fargo Dr", root.get("CUSTOMER[1]/ADDRESS"));
+
+ }
+
+ public void testInsertWithParameters() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command insert = das.createCommand("insert into CUSTOMER values (?, ?, ?)");
+ insert.setParameter(1, new Integer(10));
+ insert.setParameter(2, "Williams");
+ insert.setParameter(3, "5528 Wells Fargo Dr");
+ insert.execute();
+
+ //Verify
+ Command select = das.createCommand("Select * from CUSTOMER where ID = 10");
+ DataObject root = select.executeQuery();
+ assertEquals(1, root.getList("CUSTOMER").size());
+ assertEquals("5528 Wells Fargo Dr", root.get("CUSTOMER[1]/ADDRESS"));
+
+ }
+
+
+ public void testDelete() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ //Verify pre-condition
+ Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
+ DataObject root = select.executeQuery();
+ assertEquals(1, root.getList("CUSTOMER").size());
+
+ //Create and execute the delete command
+ Command delete = das.createCommand("delete from CUSTOMER where ID = 1");
+ delete.execute();
+
+ //Verify delete by reusing the original select command
+ root = select.executeQuery();
+ assertEquals(0, root.getList("CUSTOMER").size());
+
+ }
+
+
+ public void testUpdate() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ //Verify pre-condition
+ Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
+ DataObject root = select.executeQuery();
+ assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick"));
+
+ Command update = das.createCommand("update CUSTOMER set LASTNAME = 'Pavick' where ID = 1");
+ update.execute();
+
+ //Verify update - reuse select command
+ root = select.executeQuery();
+ assertEquals("Pavick", root.get("CUSTOMER[1]/LASTNAME"));
+
+ }
+
+ public void testUpdateWithParameters() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ //Verify pre-condition
+ Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
+ DataObject root = select.executeQuery();
+ assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick"));
+
+ Command update = das.createCommand("update CUSTOMER set LASTNAME = ? where ID = ?");
+ update.setParameter(1, "Pavick");
+ update.setParameter(2, new Integer(1));
+ update.execute();
+
+ //Verify update - reuse select command
+ root = select.executeQuery();
+ assertEquals("Pavick", root.get("CUSTOMER[1]/LASTNAME"));
+
+ }
+
+ public void testUpdateWithParmarkers() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ //Verify pre-condition
+ Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
+ DataObject root = select.executeQuery();
+ assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick"));
+
+ Command update = das.createCommand("update CUSTOMER set LASTNAME = ? where ID = ?");
+ update.setParameter(1, "Pavick");
+ update.setParameter(2, new Integer(1));
+ update.execute();
+
+ //Verify update - reuse select command
+ root = select.executeQuery();
+ assertEquals("Pavick", root.get("CUSTOMER[1]/LASTNAME"));
+
+ }
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/StoredProcs.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/StoredProcs.java
new file mode 100644
index 0000000000..4f8dbbe60c
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/StoredProcs.java
@@ -0,0 +1,186 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.data.CompanyData;
+import org.apache.tuscany.das.rdb.test.data.CustomerData;
+import org.apache.tuscany.das.rdb.test.data.OrderData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+
+public class StoredProcs extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ new CompanyData(getAutoConnection()).refresh();
+ new CustomerData(getAutoConnection()).refresh();
+ new OrderData(getAutoConnection()).refresh();
+
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ // Call a simple stored proc to read all companies
+ public void testGetCompanies() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command read = das.createCommand("{call GETALLCOMPANIES()}");
+ DataObject root = read.executeQuery();
+
+ //Verify
+ assertEquals(3, root.getList("COMPANY").size());
+ assertTrue(root.getInt("COMPANY[1]/ID") > 0);
+
+ }
+
+ public void testGetNamedCompany() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command read = das.createCommand("{call GETNAMEDCOMPANY(?)}");
+
+ read.setParameter(1, "MegaCorp");
+ DataObject root = read.executeQuery();
+
+ assertEquals("MegaCorp", root.getString("COMPANY[1]/NAME"));
+
+ }
+
+ public void testGetNamedCompanyByName() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command read = das
+ .createCommand("{call GETNAMEDCOMPANY(?)}");
+
+ read.setParameter(1, "MegaCorp");
+ DataObject root = read.executeQuery();
+
+ assertEquals("MegaCorp", root.getString("COMPANY[1]/NAME"));
+ }
+
+
+ // Retreive heirarchy using a stored proc ... new programming model
+ public void testGetCustomersAndOrder() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConfig("CustomersOrdersConfig.xml"), getConnection());
+ Command read = das.createCommand("{call getCustomerAndOrders(?)}");
+ read.setParameter(1, new Integer(1));
+
+ DataObject root = read.executeQuery();
+
+ DataObject customer = (DataObject) root.getList("CUSTOMER").get(0);
+ assertEquals(2, customer.getList("orders").size());
+
+ }
+
+ /**
+ * Call a stored proc requiring an in parameter and producing an out
+ * parameter and a resultset
+ *
+ * This stored proc takes a lastname argument and returns a graph of
+ * customers with that last name. The number of read customers is returned
+ * in the out parameter
+ */
+ public void testGetNamedCustomers() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConfig("storedProcTest.xml"), getConnection());
+ Command read = das.getCommand("getNamedCustomers");
+ read.setParameter(1, "Williams");
+ DataObject root = read.executeQuery();
+
+ Integer customersRead = (Integer) read.getParameter(2);
+
+ assertEquals(4, customersRead.intValue());
+ assertEquals(customersRead.intValue(), root.getList("CUSTOMER").size());
+
+ }
+
+ //TODO - Resolve issue with programmatic creation of GETNAMEDCUSTOMERS on DB2 and
+ //re-enable this test
+
+
+ // Simplest possible SP write
+ public void testDelete() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command delete = das.createCommand("{call DELETECUSTOMER(?)}");
+ delete.setParameter(1, new Integer(1));
+ delete.execute();
+
+ // Verify DELETE
+ Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
+ DataObject root = select.executeQuery();
+ assertTrue(root.getList("CUSTOMER").isEmpty());
+
+ }
+
+/* // For debug
+ public void testRawCall() throws Exception {
+
+ Connection c = getConnection();
+ CallableStatement cs = c.prepareCall("{call GETNAMEDCUSTOMERS(?,?)}");
+ ParameterMetaData pm = cs.getParameterMetaData();
+ int count = pm.getParameterCount();
+ for (int i = 1; i <= count; i++) {
+ int mode = pm.getParameterMode(i);
+ if (mode == ParameterMetaData.parameterModeOut
+ || mode == ParameterMetaData.parameterModeInOut)
+ cs.registerOutParameter(i, pm.getParameterType(i));
+ }
+ cs.setString(1, "Williams");
+ // cs.registerOutParameter(2,java.sql.Types.INTEGER);
+ boolean isResultSet = cs.execute();
+ System.out.println("Has a result set => " + isResultSet);
+ ResultSet rs = cs.getResultSet();
+
+ if (isResultSet) {
+ System.out.println("Results are: ");
+ while (rs.next()) {
+ System.out.println(rs.getObject(2));
+ }
+ }
+ System.out.println("Count is =>" + cs.getObject(2));
+ c.commit();
+ }
+
+ // For debug
+ public void testRawCall2() throws Exception {
+
+ Connection c = getConnection();
+ CallableStatement cs = c.prepareCall("{call getCustomerAndOrders(?)}");
+ cs.setObject(1, new Integer(1));
+ boolean isResultSet = cs.execute();
+ System.out.println("call getCustomerAndOrders(?) has a result set => "
+ + isResultSet);
+ ResultSet rs = cs.getResultSet();
+
+ write(rs);
+ c.commit();
+ }
+
+ public void testGetAllOrders() throws Exception {
+
+ System.out.println("all orders");
+ Connection c = getConnection();
+ PreparedStatement s = c.prepareStatement("select * from anorder");
+ write (s.executeQuery());
+ c.commit();
+
+ }*/
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TopDown.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TopDown.java
new file mode 100644
index 0000000000..49f093c36d
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TopDown.java
@@ -0,0 +1,73 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+import java.io.IOException;
+import java.sql.SQLException;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.customer.AnOrder;
+import org.apache.tuscany.das.rdb.test.customer.Customer;
+import org.apache.tuscany.das.rdb.test.customer.CustomerFactory;
+import org.apache.tuscany.das.rdb.test.data.CustomerData;
+import org.apache.tuscany.das.rdb.test.data.OrderData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import commonj.sdo.DataObject;
+
+public class TopDown extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ new CustomerData(getAutoConnection()).refresh();
+ new OrderData(getAutoConnection()).refresh();
+
+ }
+
+ // Uses dynamic SDOs but user provides the model
+ public void testUserProvidedModelDynamic() throws SQLException, IOException {
+
+ DAS das = DAS.FACTORY.createDAS(getConfig("staticCustomerOrder.xml"), getConnection());
+
+ Command select = das.getCommand("Customer and Orders");
+
+ SDOUtil.registerStaticTypes(CustomerFactory.class);
+
+ // Parameterize the command
+ select.setParameter(1, new Integer(1));
+
+ // Get the graph - DataGraphRoot is from the typed package
+ DataObject root = select.executeQuery();
+
+ // Modify a customer
+ Customer customer = (Customer)root.getDataObject("Customer[1]");
+ customer.setLastName("Pavick");
+
+ // Modify an order
+ AnOrder order = (AnOrder) customer.getOrders().get(0);
+ order.setProduct("Kitchen Sink 001");
+
+ // Flush changes
+ das.applyChanges((DataObject) root);
+
+ }
+
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TypeTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TypeTests.java
new file mode 100644
index 0000000000..33d8fed6fb
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TypeTests.java
@@ -0,0 +1,91 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test;
+
+/*
+ * This class provides tests for all supported "types". The current plan is to use the Data
+ * type definitions provided in the SDO 2 specification. We must test the ability to use
+ * all of these types as well as different mapping from thse types to types used in the
+ * database. For example, a SDO Data Type "STRING", might be staored as a "TIMESTAMP" in DB2.
+ *
+ */
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.data.TypesData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+
+import commonj.sdo.DataObject;
+
+
+public class TypeTests extends DasTest {
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ new TypesData(getAutoConnection()).refresh();
+ }
+
+ /**
+ * Read various types.
+ */
+ public void testRead() throws Exception {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ //Read customer 1
+ Command select = das.createCommand("Select * from TYPETEST where ID = 1");
+ DataObject root = select.executeQuery();
+
+ DataObject types = (DataObject)root.get("TYPETEST[1]");
+
+ java.sql.Timestamp ts = (java.sql.Timestamp)types.get("ATIMESTAMP");
+ assertEquals(ts, TypesData.getTimestamp());
+
+ float decimal = types.getFloat("ADECIMAL");
+ assertEquals(1234567.89f, decimal, .0001);
+
+ }
+
+
+ /**
+ * Write various types.
+ * TODO - Need to rethink the Timestamp write. My current thinking id that writes of non-SDO2 defined types
+ * require a converter
+ */
+/* public void testWrite() throws Exception {
+
+ //Read customer 1
+ Command select = Command.FACTORY.createCommand("Select * from TYPETEST where ID = 1");
+ select.setConnection(getConnection());
+ DataObject root = select.executeQuery();
+
+ DataObject types = (DataObject)root.get("TYPETEST[1]");
+ Date now = new Date();
+ types.set("ATIMESTAMP", now);
+
+ ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand();
+ apply.setConnection(getConnection());
+ apply.addPrimaryKey("TYPETEST.ID");
+ apply.execute(root);
+
+ //Verify
+ root = select.executeQuery();
+ java.sql.Timestamp ts = (java.sql.Timestamp)types.get("ATIMESTAMP");
+ assertEquals(now, ts);
+
+ }*/
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersByLastnameCommand.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersByLastnameCommand.java
new file mode 100644
index 0000000000..21a7427ace
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersByLastnameCommand.java
@@ -0,0 +1,54 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.commands;
+
+import org.apache.tuscany.das.rdb.config.Column;
+import org.apache.tuscany.das.rdb.config.Config;
+import org.apache.tuscany.das.rdb.config.ConfigFactory;
+import org.apache.tuscany.das.rdb.config.Table;
+import org.apache.tuscany.das.rdb.config.impl.ConfigFactoryImpl;
+import org.apache.tuscany.das.rdb.impl.ReadCommandImpl;
+
+
+public class ReadCustomersByLastnameCommand extends ReadCommandImpl {
+
+ private static final String sqlString = "select * from CUSTOMER where LASTNAME = ?";
+ private static final Config mapping;
+
+ static {
+ ConfigFactory factory = ConfigFactoryImpl.eINSTANCE;
+ mapping = factory.createConfig();
+ Table t = factory.createTable();
+ Column id = factory.createColumn();
+ id.setColumnName("ID");
+ id.setPrimaryKey(true);
+ Column lastname = factory.createColumn();
+ lastname.setColumnName("LASTNAME");
+ Column address = factory.createColumn();
+ address.setColumnName("ADDRESS");
+
+ t.getColumn().add(id);
+ t.getColumn().add(lastname);
+ t.getColumn().add(address);
+ t.setTableName("CUSTOMER");
+ mapping.getTable().add(t);
+ }
+
+ public ReadCustomersByLastnameCommand() {
+ super(sqlString, mapping, null);
+ }
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersCommand.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersCommand.java
new file mode 100644
index 0000000000..2b58e29aa1
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersCommand.java
@@ -0,0 +1,55 @@
+/**
+*
+* Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.tuscany.das.rdb.test.commands;
+
+import org.apache.tuscany.das.rdb.config.Column;
+import org.apache.tuscany.das.rdb.config.Config;
+import org.apache.tuscany.das.rdb.config.ConfigFactory;
+import org.apache.tuscany.das.rdb.config.Table;
+import org.apache.tuscany.das.rdb.config.impl.ConfigFactoryImpl;
+import org.apache.tuscany.das.rdb.impl.ReadCommandImpl;
+
+
+public class ReadCustomersCommand extends ReadCommandImpl {
+
+ private static final String sqlString = "select * from CUSTOMER";
+ private static final Config mapping;
+
+ static {
+ ConfigFactory factory = ConfigFactoryImpl.eINSTANCE;
+ mapping = factory.createConfig();
+ Table t = factory.createTable();
+ Column id = factory.createColumn();
+ id.setColumnName("ID");
+ id.setPrimaryKey(true);
+ Column lastname = factory.createColumn();
+ lastname.setColumnName("LASTNAME");
+ Column address = factory.createColumn();
+ address.setColumnName("ADDRESS");
+
+ t.getColumn().add(id);
+ t.getColumn().add(lastname);
+ t.getColumn().add(address);
+ t.setTableName("CUSTOMER");
+ mapping.getTable().add(t);
+ }
+
+ public ReadCustomersCommand() {
+ super(sqlString, mapping, null);
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java
new file mode 100644
index 0000000000..be678bbce6
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java
@@ -0,0 +1,60 @@
+/**
+*
+* Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.tuscany.das.rdb.test.commands;
+
+import org.apache.tuscany.das.rdb.config.Column;
+import org.apache.tuscany.das.rdb.config.Config;
+import org.apache.tuscany.das.rdb.config.ConfigFactory;
+import org.apache.tuscany.das.rdb.config.Table;
+import org.apache.tuscany.das.rdb.config.impl.ConfigFactoryImpl;
+import org.apache.tuscany.das.rdb.impl.ReadCommandImpl;
+
+
+public class ReadCustomersStaticTypesCommand extends ReadCommandImpl {
+
+ private static final String sqlString = "Select ID, LASTNAME, ADDRESS from CUSTOMER where LASTNAME = ?";
+ private static final Config mapping;
+
+ static {
+ ConfigFactory factory = ConfigFactoryImpl.eINSTANCE;
+ mapping = factory.createConfig();
+ Table t = factory.createTable();
+ Column id = factory.createColumn();
+ id.setColumnName("ID");
+ id.setPrimaryKey(true);
+ Column lastname = factory.createColumn();
+ lastname.setColumnName("LASTNAME");
+ Column address = factory.createColumn();
+ address.setColumnName("ADDRESS");
+
+ t.getColumn().add(id);
+ t.getColumn().add(lastname);
+ t.getColumn().add(address);
+ t.setTableName("CUSTOMER");
+ t.setTypeName("Customer");
+ mapping.getTable().add(t);
+
+ mapping.setDataObjectModel("http:///org.apache.tuscany.das.rdb.test/customer.xsd");
+ }
+
+ public ReadCustomersStaticTypesCommand() {
+ super(sqlString, mapping, null);
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersWithShapeCommand.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersWithShapeCommand.java
new file mode 100644
index 0000000000..6566544c39
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersWithShapeCommand.java
@@ -0,0 +1,58 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.commands;
+
+import java.util.ArrayList;
+
+import org.apache.tuscany.das.rdb.config.ConfigFactory;
+import org.apache.tuscany.das.rdb.config.ResultDescriptor;
+import org.apache.tuscany.das.rdb.config.impl.ConfigFactoryImpl;
+import org.apache.tuscany.das.rdb.impl.ReadCommandImpl;
+
+public class ReadCustomersWithShapeCommand extends ReadCommandImpl {
+// This sql string ensures that we won't have resultset metadata
+ static String sqlString = "select * from customer union select * from customer";
+ static ArrayList descriptor = new ArrayList();
+
+ static {
+ ConfigFactory factory = ConfigFactoryImpl.eINSTANCE;
+
+ ResultDescriptor desc1 = factory.createResultDescriptor();
+ desc1.setColumnName("ID");
+ desc1.setColumnType("commonj.sdo.Int");
+ desc1.setTableName("CUSTOMER");
+
+ ResultDescriptor desc2 = factory.createResultDescriptor();
+ desc2.setColumnName("LASTNAME");
+ desc2.setColumnType("commonj.sdo.String");
+ desc2.setTableName("CUSTOMER");
+
+ ResultDescriptor desc3 = factory.createResultDescriptor();
+ desc3.setColumnName("ADDRESS");
+ desc3.setColumnType("commonj.sdo.String");
+ desc3.setTableName("CUSTOMER");
+
+ descriptor.add(desc1);
+ descriptor.add(desc2);
+ descriptor.add(desc3);
+
+ }
+ public ReadCustomersWithShapeCommand() {
+ super(sqlString, null, descriptor);
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/SimpleReadCustomersWithShapeCommand.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/SimpleReadCustomersWithShapeCommand.java
new file mode 100644
index 0000000000..ac9dba6aa9
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/SimpleReadCustomersWithShapeCommand.java
@@ -0,0 +1,79 @@
+/**
+*
+* Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.tuscany.das.rdb.test.commands;
+
+import java.util.ArrayList;
+
+import org.apache.tuscany.das.rdb.config.Column;
+import org.apache.tuscany.das.rdb.config.Config;
+import org.apache.tuscany.das.rdb.config.ConfigFactory;
+import org.apache.tuscany.das.rdb.config.ResultDescriptor;
+import org.apache.tuscany.das.rdb.config.Table;
+import org.apache.tuscany.das.rdb.config.impl.ConfigFactoryImpl;
+import org.apache.tuscany.das.rdb.impl.ReadCommandImpl;
+
+public class SimpleReadCustomersWithShapeCommand extends ReadCommandImpl {
+
+ // This sql string ensures that we won't have resultset metadata
+ private static final String sqlString = "Select * from customer union select * from customer";
+ private static final ArrayList descriptor = new ArrayList();
+
+ private static final Config config;
+
+ static {
+ ConfigFactory factory = ConfigFactoryImpl.eINSTANCE;
+ config = factory.createConfig();
+ Table t = factory.createTable();
+ Column id = factory.createColumn();
+ id.setColumnName("ID");
+ id.setPrimaryKey(true);
+ Column lastname = factory.createColumn();
+ lastname.setColumnName("LASTNAME");
+ Column address = factory.createColumn();
+ address.setColumnName("ADDRESS");
+
+ t.getColumn().add(id);
+ t.getColumn().add(lastname);
+ t.getColumn().add(address);
+ t.setTableName("CUSTOMER");
+ config.getTable().add(t);
+
+ ResultDescriptor desc1 = factory.createResultDescriptor();
+ desc1.setColumnName("ID");
+ desc1.setColumnType("commonj.sdo.Int");
+ desc1.setTableName("CUSTOMER");
+
+ ResultDescriptor desc2 = factory.createResultDescriptor();
+ desc2.setColumnName("LASTNAME");
+ desc2.setColumnType("commonj.sdo.String");
+ desc2.setTableName("CUSTOMER");
+
+ ResultDescriptor desc3 = factory.createResultDescriptor();
+ desc3.setColumnName("ADDRESS");
+ desc3.setColumnType("commonj.sdo.String");
+ desc3.setTableName("CUSTOMER");
+
+ descriptor.add(desc1);
+ descriptor.add(desc2);
+ descriptor.add(desc3);
+ }
+
+ public SimpleReadCustomersWithShapeCommand() {
+ super(sqlString, config, descriptor);
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/BookData.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/BookData.java
new file mode 100644
index 0000000000..e696c8dd6b
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/BookData.java
@@ -0,0 +1,45 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.data;
+
+import java.sql.Connection;
+import java.sql.Types;
+
+import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns;
+
+
+public class BookData extends TestDataWithExplicitColumns {
+
+ //CREATE TABLE BOOK (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(50), AUTHOR VARCHAR(30), QUANTITY INT, OCC INTEGER)
+
+ private static int[] bookTypes = {Types.INTEGER, Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.INTEGER};
+
+ private static Object[][] bookData = {
+ { new Integer(1), "The Brothers Karamazov", "Fyodor Dostoevsky", new Integer(5), new Integer(17) },
+ { new Integer(2), "Cat in the Hat", "Doctor Seuss", new Integer(10), new Integer(1) }};
+
+ private static String[] bookColumns = { "BOOK_ID", "NAME", "AUTHOR", "QUANTITY", "OCC"};
+
+ public BookData(Connection connection) {
+ super(connection, bookData, bookColumns, bookTypes);
+ }
+
+ public String getTableName() {
+ return "BOOK";
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CityData.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CityData.java
new file mode 100644
index 0000000000..0ebbd6c5af
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CityData.java
@@ -0,0 +1,54 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.data;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import org.apache.tuscany.das.rdb.test.framework.TestData;
+
+
+public class CityData extends TestData {
+
+ private static Object[][] cityData = {
+ {new Integer(1), "Lizard Lick", "1"},
+ {new Integer(2), "Morrisville", "1"},
+ {new Integer(3), "Breckenridge", "2"},
+ {new Integer(4), "Barstow", "3"},
+ {new Integer(5), "Sacramento", "3"}
+
+ };
+
+ public CityData(Connection c) {
+ super(c, cityData);
+ }
+
+ public String getTableName() {
+ return "CITIES";
+ }
+
+ public void doDeletes() throws SQLException {
+ deleteRowsFromTable();
+
+ }
+
+ public void doInserts() throws SQLException {
+ insertRows();
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyData.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyData.java
new file mode 100644
index 0000000000..9c49004ba5
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyData.java
@@ -0,0 +1,45 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.data;
+
+import java.sql.Connection;
+import java.sql.Types;
+
+import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns;
+
+
+public class CompanyData extends TestDataWithExplicitColumns {
+
+ //CREATE TABLE COMPANY (ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY ,NAME VARCHAR(30))
+
+ private static int[] columnTypes = {Types.VARCHAR};
+
+ private static Object[][] companyData = { { "ACME Publishing" },
+ { "Do-rite plumbing" },
+ { "MegaCorp" } };
+
+ private static String[] companyColumns = { "NAME" };
+
+ public CompanyData(Connection connection) {
+ super(connection, companyData, companyColumns, columnTypes);
+ }
+
+ public String getTableName() {
+ return "COMPANY";
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyDeptData.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyDeptData.java
new file mode 100644
index 0000000000..66d0c25369
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyDeptData.java
@@ -0,0 +1,42 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.data;
+
+import java.sql.Connection;
+
+import org.apache.tuscany.das.rdb.test.framework.RelationshipData;
+
+
+public class CompanyDeptData extends RelationshipData {
+
+ public static Object[][] data = {
+ {"MegaCorp", "Advanced Technologies"}
+ };
+
+ public CompanyDeptData(Connection c) {
+ super(c, data);
+ }
+
+ protected String getParentRetrievalStatement() {
+ return "select id from company where name = ?";
+ }
+
+ protected String getChildUpdateStatement() {
+ return "update department set companyid = ? where department.name = ?";
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyEmpData.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyEmpData.java
new file mode 100644
index 0000000000..300bf57260
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyEmpData.java
@@ -0,0 +1,44 @@
+
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.data;
+
+import java.sql.Connection;
+
+import org.apache.tuscany.das.rdb.test.framework.RelationshipData;
+
+
+public class CompanyEmpData extends RelationshipData {
+
+ public static Object[][] data = {
+ {"Mary Smith", "ACME Publishing" },
+ {"Jane Doe", "Do-rite plumbing"},
+ {"Al Smith", "MegaCorp"}};
+
+ public CompanyEmpData(Connection c) {
+ super(c, data);
+ }
+
+ protected String getParentRetrievalStatement() {
+ return "select employee.id from employee where employee.name = ?";
+ }
+
+ protected String getChildUpdateStatement() {
+ return "update company set company.eotmid = ? where company.name = ?";
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CustomerData.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CustomerData.java
new file mode 100644
index 0000000000..149bcfc71b
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CustomerData.java
@@ -0,0 +1,45 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.data;
+
+import java.sql.Connection;
+
+import org.apache.tuscany.das.rdb.test.framework.TestData;
+
+
+public class CustomerData extends TestData {
+
+ private static Object[][] customerData = {
+ {new Integer(1), "Williams", "1212 foobar lane"},
+ {new Integer(2), "Daniel", "156 Brentfield Loop"},
+ {new Integer(3), "Williams", "456 penny lane"},
+ {new Integer(4), "Williams", "5000 pineville"},
+ {new Integer(5), "Williams", "100000 firefly lane"}
+ };
+
+ public CustomerData(Connection connection) {
+ super(connection, customerData);
+ }
+
+
+ public String getTableName() {
+ return "CUSTOMER";
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepEmpData.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepEmpData.java
new file mode 100644
index 0000000000..fbd9cf7cab
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepEmpData.java
@@ -0,0 +1,45 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.data;
+
+import java.sql.Connection;
+
+import org.apache.tuscany.das.rdb.test.framework.RelationshipData;
+
+
+public class DepEmpData extends RelationshipData {
+
+ private static Object[][] data = {
+ {"Advanced Technologies", "John Jones"},
+ {"Advanced Technologies", "Jane Doe"},
+ {"Advanced Technologies", "Al Smith"}
+ };
+
+
+ public DepEmpData(Connection c) {
+ super(c, data);
+ }
+
+ protected String getParentRetrievalStatement() {
+ return "select department.id from department where department.name = ?";
+ }
+
+ protected String getChildUpdateStatement() {
+ return "update employee set employee.departmentid = ? where employee.name = ?";
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java
new file mode 100644
index 0000000000..d3c10affdd
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java
@@ -0,0 +1,41 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.data;
+
+import java.sql.Connection;
+import java.sql.Types;
+
+import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns;
+
+
+public class DepartmentData extends TestDataWithExplicitColumns {
+
+ private static int[] columnTypes = {Types.VARCHAR, Types.VARCHAR, Types.VARCHAR};
+
+ private static Object[][] deptData = { { "Advanced Technologies", "NY", "123" } };
+
+ private static String[] deptColumns = { "NAME", "LOCATION", "NUMBER" };
+
+ public DepartmentData(Connection connection) {
+ super(connection, deptData, deptColumns, columnTypes);
+ }
+
+ public String getTableName() {
+ return "DEPARTMENT";
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/EmployeeData.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/EmployeeData.java
new file mode 100644
index 0000000000..f9dffc9360
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/EmployeeData.java
@@ -0,0 +1,45 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.data;
+
+import java.sql.Connection;
+import java.sql.Types;
+
+import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns;
+
+
+public class EmployeeData extends TestDataWithExplicitColumns {
+
+ private static int[] columnTypes = {Types.VARCHAR, Types.VARCHAR, Types.SMALLINT};
+
+ private static Object[][] employeeData = {
+ { "John Jones", "E0001", new Boolean(false) },
+ { "Mary Smith", "E0002", new Boolean(true)},
+ { "Jane Doe", "E0003", new Boolean(false)},
+ { "Al Smith", "E0004", new Boolean(true) } };
+
+ private static String[] employeeColumns = { "NAME", "SN", "MANAGER" };
+
+ public EmployeeData(Connection connection) {
+ super(connection, employeeData, employeeColumns, columnTypes);
+ }
+
+ public String getTableName() {
+ return "EMPLOYEE";
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderData.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderData.java
new file mode 100644
index 0000000000..e6a52204f8
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderData.java
@@ -0,0 +1,42 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.data;
+
+import java.sql.Connection;
+
+import org.apache.tuscany.das.rdb.test.framework.TestData;
+
+
+public class OrderData extends TestData {
+
+
+ public static Object[][] orderData = {
+ {new Integer(1), "recombobulator", new Integer(47), new Integer(1)},
+ {new Integer(2), "wrench", new Integer(17), new Integer(3)},
+ {new Integer(3), "pliers", new Integer(500), new Integer(1)},
+ {new Integer(4), "Tooth Paste", new Integer(12), new Integer(2)}
+ };
+
+ public OrderData(Connection c) {
+ super(c, orderData);
+ }
+
+ public String getTableName() {
+ return "ANORDER";
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsData.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsData.java
new file mode 100644
index 0000000000..9193f7c6d5
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsData.java
@@ -0,0 +1,43 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.data;
+
+import java.sql.Connection;
+
+import org.apache.tuscany.das.rdb.test.framework.TestData;
+
+
+public class OrderDetailsData extends TestData {
+
+ //CREATE TABLE ORDERDETAILS (ORDERID INT NOT NULL, PRODUCTID INT NOT NULL, PRICE FLOAT, PRIMARY KEY (ORDERID, PRODUCTID))
+
+ public static Object[][] orderDetailsData = {
+ {new Integer(1), new Integer(1), new Float(1.1)},
+ {new Integer(1), new Integer(2), new Float(1.2)},
+ {new Integer(2), new Integer(1), new Float(2.1)},
+ {new Integer(2), new Integer(2), new Float(2.2)}
+ };
+
+ public OrderDetailsData(Connection c) {
+ super(c, orderDetailsData);
+ }
+
+ public String getTableName() {
+ return "ORDERDETAILS";
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/PartData.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/PartData.java
new file mode 100644
index 0000000000..dd78b1be35
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/PartData.java
@@ -0,0 +1,52 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.data;
+
+import java.sql.Connection;
+import java.sql.Types;
+
+import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns;
+
+
+public class PartData extends TestDataWithExplicitColumns {
+
+
+ //CREATE TABLE PART (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(50), QUANTITY INT, PARENT_ID INT )
+
+ private static String[] partColumns = { "ID" , "NAME", "QUANTITY", "PARENT_ID"};
+
+ private static int[] columnTypes = {Types.INTEGER, Types.VARCHAR, Types.INTEGER, Types.INTEGER};
+
+ private static Object[][] partData = {
+ {new Integer(1), "Engine", new Integer(1), null},
+ {new Integer(2), "Block", new Integer(1), new Integer(1)},
+ {new Integer(3), "Cam Shaft", new Integer(2), new Integer(1)},
+ {new Integer(4), "Piston", new Integer(8), new Integer(1)},
+ {new Integer(5), "Piston Ring", new Integer(2), new Integer(4)}
+ };
+
+ public PartData(Connection connection) {
+ super(connection, partData, partColumns, columnTypes);
+ }
+
+ public String getTableName() {
+ return "PART";
+ }
+
+}
+
+
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/StateData.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/StateData.java
new file mode 100644
index 0000000000..0c6d41d096
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/StateData.java
@@ -0,0 +1,51 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.data;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import org.apache.tuscany.das.rdb.test.framework.TestData;
+
+
+public class StateData extends TestData {
+
+ public StateData(Connection c) {
+ super(c, stateData);
+ }
+
+ public String getTableName() {
+ return "STATES";
+ }
+
+ private static Object[][] stateData = {
+ {new Integer(1), "NC"},
+ {new Integer(2), "CO"},
+ {new Integer(3), "CA"}
+ };
+
+ public void doDeletes() throws SQLException {
+ deleteRowsFromTable();
+ }
+
+ public void doInserts() throws SQLException {
+ insertRows();
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/TypesData.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/TypesData.java
new file mode 100644
index 0000000000..1097b07cc5
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/TypesData.java
@@ -0,0 +1,64 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.data;
+
+import java.sql.Connection;
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.apache.tuscany.das.rdb.test.framework.TestData;
+
+
+public class TypesData extends TestData {
+
+ private static DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:ss:mm.SSS");
+ private static Timestamp timestamp = getTimestamp();
+
+ private static Object[][] customerData = {
+ {new Integer(1), timestamp, new Float(1234567.89), new Float(1234567.89)}
+ };
+
+ public TypesData(Connection connection) {
+ super(connection, customerData);
+ }
+
+ public String getTableName() {
+ return "TYPETEST";
+ }
+
+
+ //Utilities
+ private static Date getDate() {
+
+ try {
+ return dateFormat.parse("1966-12-20 00:00:00.0");
+ } catch (ParseException e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ public static Timestamp getTimestamp() {
+
+ return new Timestamp(getDate().getTime());
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DB2Setup.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DB2Setup.java
new file mode 100644
index 0000000000..75df028490
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DB2Setup.java
@@ -0,0 +1,35 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.framework;
+
+import junit.framework.Test;
+
+public class DB2Setup extends DatabaseSetup {
+
+ public DB2Setup(Test test) {
+ super(test);
+ }
+
+ protected void initConnectionProtocol() {
+
+ platformName = "DB2";
+ driverName = "com.ibm.db2.jcc.DB2Driver";
+ databaseURL = "jdbc:db2:DASTEST";
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DasTest.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DasTest.java
new file mode 100644
index 0000000000..bd195866be
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DasTest.java
@@ -0,0 +1,152 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.framework;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+
+/**
+ *
+ */
+public class DasTest extends TestCase {
+
+ public static Connection connection = null;
+
+ /**
+ * Tears down the fixture, for example, close a network connection. This
+ * method is called after a test is executed.
+ */
+ protected void tearDown() throws Exception {
+// if (usingDefaultSetup)
+// connection = null;
+ }
+
+ protected Connection getAutoConnection() throws SQLException {
+
+ Connection c = primGetConnection();
+ c.setAutoCommit(true);
+ return connection;
+
+ }
+
+ protected Connection getConnection() throws SQLException {
+
+ Connection c = primGetConnection();
+ c.setAutoCommit(false);
+ return connection;
+ }
+
+ /**
+ * This provides the default connection for runing single test cases on a
+ * chosen platform.
+ */
+ private Connection primGetConnection() {
+ if (connection == null)
+ defaultSetup();
+ return connection;
+ }
+
+
+
+ /**
+ * This is a bit of a hack since it counts on constructor initialization of the
+ * DatabaseSet up class and also calls its setUp method directly. This is a misuse
+ * of this JUnit TestSetup subclass .
+ *
+ * TODO - refactor to avoid this hackiness ... could move this logic to its own
+ * class that is then invoked by DatabaseSetUp
+ */
+ private void defaultSetup() {
+
+// DatabaseSetup setUp = new DB2Setup(this);
+ DatabaseSetup setUp = new DerbySetup(this);
+ try {
+ setUp.setUp();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+
+ //Utilities
+ protected InputStream getConfig(String fileName) throws FileNotFoundException {
+ return Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName);
+ }
+
+ protected void write(String label, ResultSet rs) throws IOException, SQLException {
+
+ ResultSetMetaData md = rs.getMetaData();
+ int count = md.getColumnCount();
+ System.out.println("Contents of ResultSet from " + label);
+ for (int i = 1; i <= count; i++) {
+ System.out.print("\t");
+ System.out.println (md.getColumnLabel(i));
+ }
+ System.out.println("");
+ while (rs.next()) {
+ for (int i = 1; i <= count; i++) {
+ System.out.print("\t");
+ System.out.print(rs.getString(i));
+ }
+ System.out.println("\t");
+ }
+ System.out.println("done");
+ }
+
+
+ protected void printList(List data) {
+ Iterator i = data.iterator();
+ while ( i.hasNext()) {
+ System.out.println();
+ DataObject obj = (DataObject) i.next();
+ Iterator props = obj.getType().getProperties().iterator();
+ while ( props.hasNext()) {
+ Property p = (Property) props.next();
+ if ( p.isMany() ) {
+ System.out.print("[ " + p.getName() + " ] ");
+ Iterator children = obj.getList(p).iterator();
+ while ( children.hasNext()) {
+ DataObject child = (DataObject) children.next();
+ System.out.print("[ " + child.get("ID") + " ]");
+ }
+ System.out.println();
+ } else if ( !p.getType().isDataType()) {
+ DataObject child = obj.getDataObject(p);
+ if ( child != null )
+ System.out.println("[ " + p.getName() + " ] " + "[ " + child.get("ID") + " ]");
+ } else {
+ System.out.println("[ " + p.getName() + " ] " + obj.get(p));
+ }
+ }
+ }
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DatabaseSetup.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DatabaseSetup.java
new file mode 100644
index 0000000000..f0c5223cf0
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DatabaseSetup.java
@@ -0,0 +1,238 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.framework;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+public class DatabaseSetup extends TestSetup {
+
+ protected String platformName = "Not initialized";
+
+ protected String driverName = "Not initialized";
+
+ protected String databaseURL = "Not initialized";
+
+ private Connection connection;
+
+ protected Statement s;
+
+ public DatabaseSetup(Test test) {
+ super(test);
+ initConnectionProtocol();
+ initConnection();
+ DasTest.connection = connection;
+ }
+
+ protected void initConnectionProtocol() {
+ // Subclasses provide implementation
+ }
+
+ private void initConnection() {
+
+ try {
+
+ Class.forName(driverName).newInstance();
+ connection = DriverManager.getConnection(databaseURL);
+ connection.setAutoCommit(false);
+
+ } catch (Exception e) {
+ if (e instanceof SQLException)
+ ((SQLException) e).getNextException().printStackTrace();
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ protected void setUp() throws Exception {
+
+ System.out.println("Setting up for " + platformName + " run");
+
+ s = connection.createStatement();
+
+ try {
+ dropTables();
+ dropProcedures();
+ createTables();
+ createProcedures();
+ connection.commit();
+ } catch (SQLException e) {
+ connection.rollback();
+ }
+
+ }
+
+ protected void tearDown() throws Exception {
+
+ System.out.println("Ending " + platformName + " run");
+ connection.close();
+
+ }
+
+ private void dropTables() {
+
+// System.out.println("Dropping tables");
+
+ String[] statements = {
+
+ "DROP TABLE CUSTOMER", "DROP TABLE ANORDER", "DROP TABLE ORDERDETAILS", "DROP TABLE ITEM",
+ "DROP TABLE COMPANY", "DROP TABLE EMPLOYEE", "DROP TABLE DEPARTMENT", "DROP TABLE BOOK",
+ "DROP TABLE PART", "DROP TABLE TYPETEST", "DROP TABLE CITIES", "DROP TABLE STATES",
+ "DROP TABLE conmgt.SERVERSTATUS"
+
+ };
+
+ for (int i = 0; i < statements.length; i++) {
+ try {
+ s.execute(statements[i]);
+ } catch (SQLException e) {
+ // If the table does not exist then ignore the exception on drop
+ if (!e.getMessage().contains("does not exist"))
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ protected void dropProcedures() {
+
+// System.out.println("Dropping procedures");
+
+ String[] statements = {
+
+ "DROP PROCEDURE GETALLCOMPANIES", "DROP PROCEDURE DELETECUSTOMER", "DROP PROCEDURE GETNAMEDCOMPANY",
+ "DROP PROCEDURE GETCUSTOMERANDORDERS", "DROP PROCEDURE GETNAMEDCUSTOMERS"
+
+ };
+
+ for (int i = 0; i < statements.length; i++) {
+ try {
+ s.execute(statements[i]);
+ } catch (SQLException e) {
+ // If the proc does not exist then ignore the exception on drop
+ if (!e.getMessage().contains("does not exist"))
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ private void createTables() {
+
+// System.out.println("Creating tables");
+
+ try {
+
+ s.execute(getCreateCustomer());
+ s.execute(getCreateAnOrder());
+ s.execute(getCreateOrderDetails());
+ s.execute(getCreateItem());
+ s.execute(getCreateCompany());
+ s.execute(getCreateEmployee());
+ s.execute(getCreateDepartment());
+ s.execute(getCreateBook());
+ s.execute(getCreatePart());
+ s.execute(getCreateTypeTest());
+ s.execute(getCreateStates());
+ s.execute(getCreateCities());
+ s.execute(getCreateServerStatus());
+
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected void createProcedures() {
+
+// System.out.println("Creating procedures");
+ try {
+
+ s.execute("CREATE PROCEDURE GETALLCOMPANIES() PARAMETER STYLE JAVA LANGUAGE JAVA READS SQL DATA DYNAMIC RESULT SETS 1 EXTERNAL NAME 'org.apache.tuscany.das.rdb.test.framework.JavaStoredProcs.getAllCompanies'");
+ s.execute("CREATE PROCEDURE DELETECUSTOMER(theId int) PARAMETER STYLE JAVA LANGUAGE JAVA MODIFIES SQL DATA EXTERNAL NAME 'org.apache.tuscany.das.rdb.test.framework.JavaStoredProcs.deleteCustomer'");
+ s.execute("CREATE PROCEDURE GETNAMEDCOMPANY(theName VARCHAR(100)) PARAMETER STYLE JAVA LANGUAGE JAVA READS SQL DATA DYNAMIC RESULT SETS 1 EXTERNAL NAME 'org.apache.tuscany.das.rdb.test.framework.JavaStoredProcs.getNamedCompany'");
+ s.execute("CREATE PROCEDURE GETCUSTOMERANDORDERS(theID INTEGER) PARAMETER STYLE JAVA LANGUAGE JAVA READS SQL DATA DYNAMIC RESULT SETS 1 EXTERNAL NAME 'org.apache.tuscany.das.rdb.test.framework.JavaStoredProcs.getCustomerAndOrders'");
+ s.execute("CREATE PROCEDURE GETNAMEDCUSTOMERS(theName VARCHAR(100), OUT theCount INTEGER) PARAMETER STYLE JAVA LANGUAGE JAVA READS SQL DATA DYNAMIC RESULT SETS 1 EXTERNAL NAME 'org.apache.tuscany.das.rdb.test.framework.JavaStoredProcs.getNamedCustomers'");
+ // TODO - "GETNAMEDCUSTOMERS" is failing on DB2 with SQLCODE: 42723. Need to investigate
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ //
+ // This section povides methods that return strings for table creation.
+ // Platform-specific sublcasses
+ // can override these as necessary
+ //
+
+ protected String getCreateCustomer() {
+ return "CREATE TABLE CUSTOMER (ID INT PRIMARY KEY NOT NULL, LASTNAME VARCHAR(30) DEFAULT 'Garfugengheist', ADDRESS VARCHAR(30))";
+ }
+
+ protected String getCreateAnOrder() {
+ return "CREATE TABLE ANORDER (ID INT PRIMARY KEY NOT NULL, PRODUCT VARCHAR(30), QUANTITY INT, CUSTOMER_ID INT)";
+ }
+
+ protected String getCreateOrderDetails() {
+ return "CREATE TABLE ORDERDETAILS (ORDERID INT NOT NULL, PRODUCTID INT NOT NULL, PRICE FLOAT, PRIMARY KEY (ORDERID, PRODUCTID))";
+ }
+
+ protected String getCreateItem() {
+ return "CREATE TABLE ITEM (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(30))";
+ }
+
+ protected String getCreateCompany() {
+ return "CREATE TABLE COMPANY (ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY ,NAME VARCHAR(30), EOTMID INT)";
+ }
+
+ protected String getCreateEmployee() {
+ return "CREATE TABLE EMPLOYEE (ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY, NAME VARCHAR(30), SN VARCHAR(10), MANAGER SMALLINT, DEPARTMENTID INT)";
+ }
+
+ protected String getCreateDepartment() {
+ return "CREATE TABLE DEPARTMENT (ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY, NAME VARCHAR(30), LOCATION VARCHAR(30), NUMBER VARCHAR(10), COMPANYID INT)";
+ }
+
+ protected String getCreateBook() {
+ return "CREATE TABLE BOOK (BOOK_ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(50), AUTHOR VARCHAR(30), QUANTITY INT, OCC INTEGER)";
+ }
+
+ protected String getCreatePart() {
+ return "CREATE TABLE PART (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(50), QUANTITY INT, PARENT_ID INT )";
+ }
+
+ protected String getCreateTypeTest() {
+ return "CREATE TABLE TYPETEST (ID INT PRIMARY KEY NOT NULL, ATIMESTAMP TIMESTAMP, ADECIMAL DECIMAL(9,2), AFLOAT FLOAT)";
+ }
+
+ protected String getCreateStates() {
+ return "CREATE TABLE STATES (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(2))";
+ }
+
+ protected String getCreateCities() {
+ return "CREATE TABLE CITIES (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(50), STATE_ID INT, CONSTRAINT FK1 FOREIGN KEY (STATE_ID) REFERENCES STATES (ID) ON DELETE NO ACTION ON UPDATE NO ACTION)";
+ }
+
+ protected String getCreateServerStatus() {
+
+ return "CREATE TABLE CONMGT.SERVERSTATUS (STATUSID INTEGER PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1 ,INCREMENT BY 1), MANAGEDSERVERID INTEGER NOT NULL, TIMESTAMP TIMESTAMP NOT NULL)";
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DerbySetup.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DerbySetup.java
new file mode 100644
index 0000000000..082b1ec50a
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DerbySetup.java
@@ -0,0 +1,42 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.framework;
+
+import java.util.Properties;
+
+import junit.framework.Test;
+
+public class DerbySetup extends DatabaseSetup {
+
+ public DerbySetup(Test test) {
+ super(test);
+ }
+
+ protected void initConnectionProtocol() {
+
+ //Set the derby property to explicitly specify the database location relative
+ //from current directory to "target"
+ Properties p = System.getProperties();
+ p.put("derby.system.home", "target");
+
+ platformName = "Derby";
+ driverName = "org.apache.derby.jdbc.EmbeddedDriver";
+ databaseURL = "jdbc:derby:dastest; create = true";
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/JavaStoredProcs.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/JavaStoredProcs.java
new file mode 100644
index 0000000000..cd314e0fce
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/JavaStoredProcs.java
@@ -0,0 +1,79 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.framework;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+/**
+ * Stored Procedures for DB2 and Derby SP tests
+ *
+ */
+public class JavaStoredProcs {
+
+ public static void getAllCompanies(ResultSet[] results) throws SQLException {
+
+ Connection conn = DriverManager.getConnection("jdbc:default:connection");
+ PreparedStatement ps = conn.prepareStatement("SELECT * FROM COMPANY");
+ results[0] = ps.executeQuery();
+ }
+
+ public static void deleteCustomer(int theId) throws SQLException {
+
+ Connection conn = DriverManager.getConnection("jdbc:default:connection");
+ PreparedStatement ps = conn.prepareStatement("DELETE FROM CUSTOMER WHERE ID = ?");
+ ps.setInt(1, theId);
+ ps.execute();
+
+ }
+
+ public static void getNamedCompany(String theName, ResultSet[] results) throws SQLException {
+
+ Connection conn = DriverManager.getConnection("jdbc:default:connection");
+ PreparedStatement ps = conn.prepareStatement("SELECT * FROM COMPANY WHERE NAME = ?");
+ ps.setString(1, theName);
+ results[0] = ps.executeQuery();
+ }
+
+ public static void getCustomerAndOrders(int theId, ResultSet[] results) throws SQLException {
+
+ Connection conn = DriverManager.getConnection("jdbc:default:connection");
+ PreparedStatement ps = conn
+ .prepareStatement("SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID WHERE CUSTOMER.ID = ?");
+ ps.setInt(1, theId);
+ results[0] = ps.executeQuery();
+ }
+
+ public static void getNamedCustomers(String theName, int[] outCount, ResultSet[] results) throws SQLException {
+
+ Connection conn = DriverManager.getConnection("jdbc:default:connection");
+ PreparedStatement ps = conn.prepareStatement("SELECT * FROM CUSTOMER WHERE LASTNAME = ?");
+ ps.setString(1, theName);
+ results[0] = ps.executeQuery();
+
+ ps = conn.prepareStatement("SELECT COUNT(*) FROM CUSTOMER WHERE LASTNAME = ?");
+ ps.setString(1, theName);
+
+ ResultSet rs = ps.executeQuery();
+ rs.next();
+ outCount[0] = rs.getInt(1);
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/MySQLSetup.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/MySQLSetup.java
new file mode 100644
index 0000000000..5cec322e70
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/MySQLSetup.java
@@ -0,0 +1,95 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.framework;
+
+import java.sql.SQLException;
+
+import junit.framework.Test;
+
+public class MySQLSetup extends DatabaseSetup {
+
+ public MySQLSetup(Test test) {
+ super(test);
+ }
+
+ protected void initConnectionProtocol() {
+
+ platformName = "MySQL";
+ driverName = "com.mysql.jdbc.Driver";
+ databaseURL = "jdbc:mysql:///dastest?user=dastester&password=dastester";
+
+ }
+
+
+ protected void createProcedures () {
+
+ String createGetAllCompanies =
+ "CREATE PROCEDURE `dastest`.`GETALLCOMPANIES` () "+
+ " SELECT * FROM COMPANY ";
+
+
+ String createDeleteCustomer =
+ "CREATE PROCEDURE `dastest`.`DELETECUSTOMER` (theId INT) " +
+ " DELETE FROM CUSTOMER WHERE ID = theId ";
+
+
+// String createGetNamedCustomers =
+// "CREATE PROCEDURE `dastest`.`GETNAMEDCUSTOMERS`(IN thename VARCHAR(30), OUT theCount INTEGER ) " +
+// " BEGIN " +
+// " SELECT * FROM CUSTOMER AS CUSTOMER WHERE LASTNAME = theName; " +
+// " SET theCount = (SELECT COUNT(*) FROM CUSTOMER WHERE LASTNAME = theName); " +
+// " END ";
+
+ String createGetCustomerAndOrders =
+ " CREATE PROCEDURE `dastest`.`GETCUSTOMERANDORDERS` (theId INT) " +
+ " SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID WHERE CUSTOMER.ID = theId ";
+
+
+ String createGetNamedCompany =
+ " CREATE PROCEDURE `dastest`.`GETNAMEDCOMPANY` (theName VARCHAR(100)) " +
+ " SELECT * FROM COMPANY WHERE NAME = theName";
+
+ System.out.println("Creating procedures");
+ try {
+
+ s.execute(createGetAllCompanies);
+ s.execute(createDeleteCustomer);
+ s.execute(createGetNamedCompany);
+ s.execute(createGetCustomerAndOrders);
+// s.execute(createGetNamedCustomers);
+//TODO - add this back after DB2 problem is resolved
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+
+ //Overrides for table creation
+ protected String getCreateCompany() {
+ return "CREATE TABLE COMPANY (ID INT PRIMARY KEY NOT NULL AUTO_INCREMENT, NAME VARCHAR(30))";
+ }
+ protected String getCreateEmployee() {
+ return "CREATE TABLE EMPLOYEE (ID INT PRIMARY KEY NOT NULL AUTO_INCREMENT, NAME VARCHAR(30), SN VARCHAR(10), MANAGER SMALLINT, DEPARTMENTID INT)";
+ }
+ protected String getCreateDepartment() {
+ return "CREATE TABLE DEPARTMENT (ID INT PRIMARY KEY NOT NULL AUTO_INCREMENT, NAME VARCHAR(30), LOCATION VARCHAR(30), NUMBER VARCHAR(10), COMPANYID INT, EOTM INT)";
+ }
+ protected String getCreateTypeTest() {
+ return "CREATE TABLE TYPETEST (ID INT PRIMARY KEY NOT NULL, ATIMESTAMP DATETIME, ADECIMAL DECIMAL(9,2), AFLOAT FLOAT)";
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/RelationshipData.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/RelationshipData.java
new file mode 100644
index 0000000000..330320656e
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/RelationshipData.java
@@ -0,0 +1,81 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.framework;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+public abstract class RelationshipData {
+ protected Object[][] data;
+ private int currentRow = -1;
+ protected Connection connection;
+
+
+ public RelationshipData(Connection c, Object[][] inputData) {
+ this.connection = c;
+ this.data = inputData;
+ }
+
+ public int size() {
+ return data[0].length;
+ }
+
+ public int numberOfRows() {
+ return data.length;
+ }
+
+ public boolean next() {
+ ++currentRow;
+ if ( currentRow < numberOfRows() )
+ return true;
+ else
+ return false;
+ }
+
+
+ public void refresh() throws SQLException {
+ updateRelationships();
+ }
+
+ protected abstract String getParentRetrievalStatement();
+ protected abstract String getChildUpdateStatement();
+
+
+ protected void updateRelationships() throws SQLException {
+ // { MegaCorp, Advanced Technologies }
+ // select company.id from company where company.name = ?
+ PreparedStatement retrieveParent = connection.prepareStatement(getParentRetrievalStatement());
+ // update department set department.companyid = ? where department.name = ?
+ PreparedStatement updateChild = connection.prepareStatement(getChildUpdateStatement());
+
+ while ( next() ) {
+ retrieveParent.setObject(1, data[currentRow][0]);
+ retrieveParent.execute();
+ ResultSet rs = retrieveParent.getResultSet();
+ rs.next();
+ Object parentID = rs.getObject(1);
+ retrieveParent.clearParameters();
+
+ updateChild.setObject(1, parentID);
+ updateChild.setObject(2, data[currentRow][1]);
+ updateChild.execute();
+ updateChild.clearParameters();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestData.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestData.java
new file mode 100644
index 0000000000..686433bfc8
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestData.java
@@ -0,0 +1,87 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.framework;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+
+public abstract class TestData {
+
+ protected Object[][] data;
+ private int currentRow = -1;
+ protected Connection connection;
+
+
+ public TestData(Connection c, Object[][] customerData) {
+ this.connection = c;
+ this.data = customerData;
+ }
+
+ public int size() {
+ return data[0].length;
+ }
+
+ public int numberOfRows() {
+ return data.length;
+ }
+
+ public boolean next() {
+ ++currentRow;
+ if ( currentRow < numberOfRows() )
+ return true;
+ else
+ return false;
+ }
+
+ public abstract String getTableName();
+
+
+ public Object getObject(int i) {
+ return data[currentRow][i-1];
+ }
+
+ public void refresh() throws SQLException {
+ deleteRowsFromTable();
+ insertRows();
+ }
+
+ protected void deleteRowsFromTable() throws SQLException {
+ PreparedStatement ps = connection.prepareStatement("delete from " + getTableName());
+ ps.execute();
+ }
+
+ protected void insertRows() throws SQLException {
+ StringBuffer sql = new StringBuffer();
+ sql.append("insert into ");
+ sql.append(getTableName());
+ sql.append(" values (");
+ for ( int i=1; i < size(); i++) {
+ sql.append("?,");
+ }
+ sql.append("?)");
+ PreparedStatement ps = connection.prepareStatement(sql.toString());
+
+ while ( next() ) {
+ for ( int i=1; i <= size(); i++ ) {
+ ps.setObject(i, getObject(i));
+ }
+ ps.execute();
+ ps.clearParameters();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestDataWithExplicitColumns.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestDataWithExplicitColumns.java
new file mode 100644
index 0000000000..8ded99af9b
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestDataWithExplicitColumns.java
@@ -0,0 +1,82 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.framework;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+
+import org.apache.tuscany.das.rdb.util.DebugUtil;
+
+
+public abstract class TestDataWithExplicitColumns extends TestData {
+
+ protected String[] columns;
+ protected int[] sqlTypes;
+
+ private static boolean debug = false;
+
+ public TestDataWithExplicitColumns(Connection c, Object[][] data,
+ String[] columns, int[] sqlTypes) {
+ super(c, data);
+ this.columns = columns;
+ this.sqlTypes = sqlTypes;
+ }
+
+ private String getColumn(int i) {
+ return columns[i - 1];
+ }
+
+ private int getSqlType(int i) {
+ return (sqlTypes[i - 1]);
+ }
+
+ // Create an insert statement of the following form ...
+ // "INSERT INTO table_name (column1, column2,...) VALUES (value1, value2,....)"
+ // This is necessary for tables with a generated column since the PK value is not provided
+ protected void insertRows() throws SQLException {
+ StringBuffer sql = new StringBuffer();
+ sql.append("insert into ");
+ sql.append(getTableName());
+
+ sql.append(" (");
+ for (int i = 1; i <= size(); i++) {
+ sql.append(getColumn(i));
+ if ( i < size() )
+ sql.append(',');
+ }
+ sql.append(" )");
+
+ sql.append(" values (");
+ for (int i = 1; i < size(); i++) {
+ sql.append("?,");
+ }
+ sql.append("?)");
+
+ DebugUtil.debugln(getClass(), debug, sql.toString());
+ PreparedStatement ps = connection.prepareStatement(sql.toString());
+
+ while (next()) {
+ for (int i = 1; i <= size(); i++) {
+ ps.setObject(i, getObject(i), getSqlType(i));
+ }
+ ps.execute();
+ ps.clearParameters();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/IntegerToBooleanConverter.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/IntegerToBooleanConverter.java
new file mode 100644
index 0000000000..e25d2c4c95
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/IntegerToBooleanConverter.java
@@ -0,0 +1,40 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.mappings;
+
+import org.apache.tuscany.das.rdb.Converter;
+
+public class IntegerToBooleanConverter implements Converter {
+
+ public IntegerToBooleanConverter() {
+ super();
+ }
+
+ public Object getPropertyValue(Object columnData) {
+ Integer value = (Integer) columnData;
+ return value.intValue() == 0 ? Boolean.FALSE : Boolean.TRUE;
+ }
+
+ public Object getColumnValue(Object propertyData) {
+ Boolean value = (Boolean) propertyData;
+ if ( value.booleanValue())
+ return new Integer(1);
+ else
+ return new Integer(0);
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/SillyDateStringConverter.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/SillyDateStringConverter.java
new file mode 100644
index 0000000000..7c164bd675
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/SillyDateStringConverter.java
@@ -0,0 +1,73 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.mappings;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.apache.tuscany.das.rdb.Converter;
+
+
+public class SillyDateStringConverter implements Converter {
+
+ public SillyDateStringConverter() {
+ super();
+ }
+
+ private static DateFormat myformat = new SimpleDateFormat("yyyy.MM.dd");
+
+ private static Date kbday;
+
+ private static Date tbday;
+
+ static {
+ try {
+ kbday = myformat.parse("1957.09.27");
+ tbday = myformat.parse("1966.12.20");
+ } catch (ParseException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public Object getPropertyValue(Object columnData) {
+
+ if (columnData.equals("Williams"))
+ return kbday;
+
+ if (columnData.equals("Pavick"))
+ return tbday;
+
+ throw new IllegalArgumentException();
+
+ }
+
+ public Object getColumnValue(Object propertyData) {
+
+ if (propertyData.equals(kbday))
+ return "Williams";
+
+ if (propertyData.equals(tbday))
+ return "Pavick";
+
+ throw new IllegalArgumentException();
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToIntegerConverter.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToIntegerConverter.java
new file mode 100644
index 0000000000..8ff57aef6d
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToIntegerConverter.java
@@ -0,0 +1,37 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.mappings;
+
+import org.apache.tuscany.das.rdb.Converter;
+
+public class StringToIntegerConverter implements Converter {
+
+ public StringToIntegerConverter() {
+ super();
+ }
+
+ public Object getPropertyValue(Object columnData) {
+ // System.out.println("Converting object.. " + columnData);
+
+ return new Integer(columnData.toString());
+ }
+
+ public Object getColumnValue(Object columnData) {
+ return columnData.toString();
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToLongConverter.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToLongConverter.java
new file mode 100644
index 0000000000..74a5e2917f
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToLongConverter.java
@@ -0,0 +1,35 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.mappings;
+
+import org.apache.tuscany.das.rdb.Converter;
+
+public class StringToLongConverter implements Converter {
+
+ public StringToLongConverter() {
+ super();
+ }
+
+ public Object getPropertyValue(Object columnData) {
+ return new Long(columnData.toString());
+ }
+
+ public Object getColumnValue(Object columnData) {
+ return columnData.toString();
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllCommonTests.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllCommonTests.java
new file mode 100644
index 0000000000..14849b8650
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllCommonTests.java
@@ -0,0 +1,100 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.suites;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.tuscany.das.rdb.test.AliasTests;
+import org.apache.tuscany.das.rdb.test.BestPracticeTests;
+import org.apache.tuscany.das.rdb.test.CUDGeneration;
+import org.apache.tuscany.das.rdb.test.CommandGroupTests;
+import org.apache.tuscany.das.rdb.test.CompanyTests;
+import org.apache.tuscany.das.rdb.test.CompoundKeyTests;
+import org.apache.tuscany.das.rdb.test.ConverterTests;
+import org.apache.tuscany.das.rdb.test.CorrectedDefectTests;
+import org.apache.tuscany.das.rdb.test.CrudWithChangeHistory;
+import org.apache.tuscany.das.rdb.test.ExceptionTests;
+import org.apache.tuscany.das.rdb.test.GeneratedCommandTests;
+import org.apache.tuscany.das.rdb.test.GeneratedId;
+import org.apache.tuscany.das.rdb.test.GraphMergeTests;
+import org.apache.tuscany.das.rdb.test.NameMappingTests;
+import org.apache.tuscany.das.rdb.test.OCCTests;
+import org.apache.tuscany.das.rdb.test.OneToOneRelationshipTests;
+import org.apache.tuscany.das.rdb.test.OperationOrderingTests;
+import org.apache.tuscany.das.rdb.test.Paging;
+import org.apache.tuscany.das.rdb.test.PartialUpdateTests;
+import org.apache.tuscany.das.rdb.test.PassiveConnectionTests;
+import org.apache.tuscany.das.rdb.test.ProgrammaticConfigTests;
+import org.apache.tuscany.das.rdb.test.RecursiveTests;
+import org.apache.tuscany.das.rdb.test.RelationshipTests;
+import org.apache.tuscany.das.rdb.test.ResultSetShapeTests;
+import org.apache.tuscany.das.rdb.test.SerializationTests;
+import org.apache.tuscany.das.rdb.test.SimplestCrud;
+import org.apache.tuscany.das.rdb.test.StoredProcs;
+import org.apache.tuscany.das.rdb.test.TopDown;
+import org.apache.tuscany.das.rdb.test.TypeTests;
+import org.apache.tuscany.das.rdb.test.typed.SimplestStaticCrud;
+
+public class AllCommonTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("All platform-common DAS tests");
+ //$JUnit-BEGIN$
+
+ suite.addTest(new TestSuite (SimplestCrud.class));
+ suite.addTest(new TestSuite (CrudWithChangeHistory.class));
+ suite.addTest(new TestSuite (SimplestStaticCrud.class));
+ suite.addTest(new TestSuite (Paging.class));
+ suite.addTest(new TestSuite (GeneratedId.class));
+
+ suite.addTest(new TestSuite (StoredProcs.class));
+ suite.addTest(new TestSuite (CUDGeneration.class));
+ suite.addTest(new TestSuite (TopDown.class));
+ suite.addTest(new TestSuite (OCCTests.class));
+ suite.addTest(new TestSuite (RecursiveTests.class));
+
+ suite.addTest(new TestSuite (GraphMergeTests.class));
+ suite.addTest(new TestSuite (CompoundKeyTests.class));
+ suite.addTest(new TestSuite (RelationshipTests.class));
+ suite.addTest(new TestSuite (NameMappingTests.class));
+ suite.addTest(new TestSuite (GeneratedCommandTests.class));
+
+ suite.addTest(new TestSuite (CompanyTests.class));
+ suite.addTest(new TestSuite (ResultSetShapeTests.class));
+ suite.addTest(new TestSuite (TypeTests.class));
+ suite.addTest(new TestSuite (OperationOrderingTests.class));
+ suite.addTest(new TestSuite (ConverterTests.class));
+
+ suite.addTest(new TestSuite (PartialUpdateTests.class));
+ suite.addTest(new TestSuite (ExceptionTests.class));
+ suite.addTest(new TestSuite (PassiveConnectionTests.class));
+ suite.addTest(new TestSuite (SerializationTests.class));
+
+ suite.addTest(new TestSuite (CommandGroupTests.class));
+ suite.addTest(new TestSuite (BestPracticeTests.class));
+ suite.addTest(new TestSuite (CorrectedDefectTests.class));
+ suite.addTest(new TestSuite (OneToOneRelationshipTests.class));
+
+ suite.addTest(new TestSuite (ProgrammaticConfigTests.class));
+ suite.addTest(new TestSuite (AliasTests.class));
+
+ //$JUnit-END$
+ return suite;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDB2.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDB2.java
new file mode 100644
index 0000000000..6c102743a5
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDB2.java
@@ -0,0 +1,39 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.suites;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.tuscany.das.rdb.test.ReadDBSchemaTests;
+import org.apache.tuscany.das.rdb.test.framework.DB2Setup;
+
+public class AllTestsDB2 {
+
+
+ public static Test suite() {
+
+ TestSuite suite = new TestSuite();
+ suite.addTest(AllCommonTests.suite());
+ suite.addTest(new TestSuite (ReadDBSchemaTests.class));
+
+ TestSuite suite2 = new TestSuite("All DAS tests on DB2");
+ suite2.addTest(new DB2Setup(suite));
+ return suite2;
+
+ }
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDerby.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDerby.java
new file mode 100644
index 0000000000..c6ea850e76
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDerby.java
@@ -0,0 +1,34 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.suites;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.tuscany.das.rdb.test.framework.DerbySetup;
+
+public class AllTestsDerby extends TestSuite {
+
+
+ public static Test suite() {
+
+ TestSuite suite = new TestSuite("All DAS tests on Derby");
+ suite.addTest(new DerbySetup(AllCommonTests.suite()));
+ return suite;
+
+ }
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsMySQL.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsMySQL.java
new file mode 100644
index 0000000000..20cc727afb
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsMySQL.java
@@ -0,0 +1,34 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.suites;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.tuscany.das.rdb.test.framework.MySQLSetup;
+
+public class AllTestsMySQL {
+
+
+ public static Test suite() {
+
+ TestSuite suite = new TestSuite("All DAS tests on MySQL");
+ suite.addTest(new MySQLSetup(AllCommonTests.suite()));
+ return suite;
+
+ }
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/typed/SimplestStaticCrud.java b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/typed/SimplestStaticCrud.java
new file mode 100644
index 0000000000..26dbffe8f7
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/typed/SimplestStaticCrud.java
@@ -0,0 +1,56 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.das.rdb.test.typed;
+
+import java.io.InputStream;
+import java.util.Collection;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.test.customer.CustomerFactory;
+import org.apache.tuscany.das.rdb.test.data.CustomerData;
+import org.apache.tuscany.das.rdb.test.framework.DasTest;
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import commonj.sdo.DataObject;
+
+
+/**
+ */
+public class SimplestStaticCrud extends DasTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ new CustomerData(getAutoConnection()).refresh();
+ }
+
+ public void testRead() throws Exception {
+ InputStream mapping = getClass().getClassLoader().getResourceAsStream("basicStaticCustomer.xml");
+ DAS das = DAS.FACTORY.createDAS(mapping, getConnection());
+ SDOUtil.registerStaticTypes(CustomerFactory.class);
+
+ Command select = das.createCommand("Select ID, LASTNAME, ADDRESS from CUSTOMER where LASTNAME = ?");
+ select.setParameter(1, "Williams");
+
+ DataObject root = select.executeQuery();
+
+ Collection customers = root.getList("Customer");
+ assertEquals(4, customers.size());
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/1xM_mapping_no_cud.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/1xM_mapping_no_cud.xml
new file mode 100644
index 0000000000..e1fdc93078
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/1xM_mapping_no_cud.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <Table tableName="CUSTOMER" typeName="Customer">
+ <Column columnName="ID" propertyName="ID" primaryKey="true"/>
+ </Table>
+
+ <Table tableName="ANORDER" typeName="AnOrder">
+ <Column columnName="CUSTOMER_ID" propertyName="Customer_ID"/>
+ <Column columnName="ID" propertyName="ID" primaryKey="true"/>
+ </Table>
+
+ <Relationship name="orders" primaryKeyTable="CUSTOMER" foreignKeyTable="ANORDER" many="true">
+ <KeyPair primaryKeyColumn="ID" foreignKeyColumn="CUSTOMER_ID"/>
+ </Relationship>
+
+</Config>
+
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/BooksConfig.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/BooksConfig.xml
new file mode 100644
index 0000000000..3f65e2beb9
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/BooksConfig.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <Command name="select book 1" SQL="select * from BOOK where BOOK_ID = 1" kind="Select"/>
+ <Command name="update book 1" SQL="update BOOK set OCC = ? where BOOK_ID = 1" kind="Update"/>
+
+ <Table tableName="BOOK">
+ <Column columnName="BOOK_ID" primaryKey="true"/>
+ <Column columnName="OCC" collision="true"/>
+ </Table>
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/BooksConfigWithAlias.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/BooksConfigWithAlias.xml
new file mode 100644
index 0000000000..8eea4194d4
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/BooksConfigWithAlias.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <Command name="get all books" SQL="SELECT * FROM BOOK" kind="Select"/>
+
+ <Command name="get Cat in the Hat" SQL="SELECT * FROM BOOK WHERE NAME = 'Cat in the Hat'" kind="Select"/>
+
+ <Command name="get book by ID" SQL="SELECT * FROM BOOK WHERE BOOK.BOOK_ID = ?" kind="Select"/>
+
+
+
+ <Table tableName="BOOK" typeName="Book">
+ <Column columnName="BOOK_ID" primaryKey="true"/>
+ <Column columnName="AUTHOR" propertyName="Writer"/>
+ <Column columnName="OCC" collision="true"/>
+ </Table>
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CompanyConfig.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CompanyConfig.xml
new file mode 100644
index 0000000000..425ff02df7
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CompanyConfig.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <Command name="all companies" SQL="select * from COMPANY" kind="Select"/>
+
+ <Command name="all companies and departments" SQL="select * from COMPANY left outer join DEPARTMENT on COMPANY.ID = DEPARTMENT.COMPANYID" kind="Select"/>
+
+ <Command name="all departments for company" SQL="select * from COMPANY inner join DEPARTMENT on COMPANY.ID = DEPARTMENT.COMPANYID where COMPANY.ID = ?" kind="Select"/>
+
+ <Command name="company by id with departments" SQL="select * from COMPANY left outer join DEPARTMENT on COMPANY.ID = DEPARTMENT.COMPANYID where COMPANY.ID = ?" kind="Select"/>
+
+ <Table tableName="COMPANY">
+ <Column columnName="ID" primaryKey="true" generated="true"/>
+ </Table>
+
+ <Table tableName="DEPARTMENT">
+ <Column columnName="ID" primaryKey="true" generated="true"/>
+ </Table>
+
+ <Relationship name="departments" primaryKeyTable="COMPANY" foreignKeyTable="DEPARTMENT" many="true">
+ <KeyPair primaryKeyColumn="ID" foreignKeyColumn="COMPANYID"/>
+ </Relationship>
+
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CompanyEmployeeConfig.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CompanyEmployeeConfig.xml
new file mode 100644
index 0000000000..8fd75441b1
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CompanyEmployeeConfig.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <Command name="get all companies" SQL="select * from COMPANY" kind = "Select"/>
+
+ <Command name="get named employee" SQL="select * from EMPLOYEE where NAME= ?" kind = "Select"/>
+
+ <Command name="get named employee with company"
+ SQL="select * from EMPLOYEE left outer join COMPANY on EMPLOYEE.ID = COMPANY.EOTMID where EMPLOYEE.NAME= ?" kind = "Select"/>
+
+ <Command name="get employee by ID" SQL="select * from EMPLOYEE where ID= ?" kind = "Select"/>
+
+ <Command name="get all employees" SQL="select * from EMPLOYEE" kind = "Select"/>
+
+ <Command name="get companies with employee of the month"
+ SQL="select * from COMPANY left outer join EMPLOYEE on COMPANY.EOTMID = EMPLOYEE.ID" kind="Select"/>
+
+
+ <Table tableName="COMPANY">
+ <Column columnName="ID" primaryKey="true" generated="true"/>
+ </Table>
+
+ <Table tableName="DEPARTMENT">
+ <Column columnName="ID" primaryKey="true" generated="true"/>
+ </Table>
+
+ <Table tableName="EMPLOYEE">
+ <Column columnName="ID" primaryKey="true" generated="true"/>
+ </Table>
+
+ <Relationship name="company->employee" primaryKeyTable="EMPLOYEE" foreignKeyTable="COMPANY" many="false" >
+ <KeyPair primaryKeyColumn="ID" foreignKeyColumn="EOTMID" />
+ </Relationship>
+
+</Config>
+
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CustOrdersConnectionProps.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CustOrdersConnectionProps.xml
new file mode 100644
index 0000000000..22de7ad66f
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CustOrdersConnectionProps.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <Command name="all customers" SQL="select * from CUSTOMER" kind="Select"/>
+
+ <Command name="customer and orders"
+ SQL="select * from CUSTOMER left join ANORDER on CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = ?"
+ kind="Select">
+<!-- <Parameter name=":ID"/> -->
+ </Command>
+
+ <Command name="customer and orders"
+ SQL="select * from CUSTOMER left join ANORDER on CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = ?"
+ kind="Select">
+ <Parameter name=":ID"/>
+ </Command>
+
+ <!-- Test usage of '?' rather than named parameter -->
+ <Command name="order by id with ?" SQL="select * from ANORDER where ANORDER.ID = ?"
+ kind="Select">
+ <Parameter name=":ID"/>
+ </Command>
+
+ <Command name="update customer"
+ SQL="update CUSTOMER set LASTNAME = 'Pavick' where ID = ?"
+ kind="Update">
+ <Parameter name="ID"/>
+ </Command>
+
+ <Table tableName="CUSTOMER">
+ <Column columnName="ID" primaryKey="true"/>
+ </Table>
+
+ <Table tableName="ANORDER">
+ <Column columnName="ID" primaryKey="true"/>
+ </Table>
+
+ <Relationship name="orders" primaryKeyTable="CUSTOMER"
+ foreignKeyTable="ANORDER" many="true">
+ <KeyPair primaryKeyColumn="ID" foreignKeyColumn="CUSTOMER_ID"/>
+ </Relationship>
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CustomerConfigWithConverter.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CustomerConfigWithConverter.xml
new file mode 100644
index 0000000000..67941aef83
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CustomerConfigWithConverter.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+
+ <Command name="testArbitraryConverter" SQL="Select * from CUSTOMER where ID = 1" kind="Select">
+ <ResultDescriptor columnName="ID" tableName="CUSTOMER" columnType="commonj.sdo.IntObject"/>
+ <ResultDescriptor columnName="LASTNAME" tableName="CUSTOMER" columnType="commonj.sdo.Date"/>
+ <ResultDescriptor columnName="ADDRESS" tableName="CUSTOMER" columnType="commonj.sdo.String"/>
+ </Command>
+
+ <Table tableName="CUSTOMER">
+ <Column columnName="ID" primaryKey="true"/>
+ <Column columnName="LASTNAME" converterClassName="org.apache.tuscany.das.rdb.test.mappings.SillyDateStringConverter"/>
+ </Table>
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CustomerConfigWithIDConverter.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CustomerConfigWithIDConverter.xml
new file mode 100644
index 0000000000..10e17d94df
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CustomerConfigWithIDConverter.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <Command name="literal" SQL="Select 99, 'Roosevelt', '1600 Pennsylvania Avenue' from customer" kind="Select">
+ <ResultDescriptor columnName="ID" tableName="CUSTOMER" columnType="commonj.sdo.Long"/>
+ <ResultDescriptor columnName="LASTNAME" tableName="CUSTOMER" columnType="commonj.sdo.String"/>
+ <ResultDescriptor columnName="ADDRESS" tableName="CUSTOMER" columnType="commonj.sdo.String"/>
+ </Command>
+
+ <Table tableName="CUSTOMER">
+ <Column columnName="ID" converterClassName="org.apache.tuscany.das.rdb.test.mappings.StringToLongConverter"/>
+ </Table>
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CustomersOrdersConfig.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CustomersOrdersConfig.xml
new file mode 100644
index 0000000000..4ec809416d
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/CustomersOrdersConfig.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <Command name="all customers" SQL="select * from CUSTOMER" kind="Select"/>
+
+ <Command name="customer and orders"
+ SQL="select * from CUSTOMER left join ANORDER on CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = ?"
+ kind="Select">
+ <Parameter name=":ID"/>
+ </Command>
+
+ <Command name="order by id" SQL="select * from ANORDER where ANORDER.ID = ?"
+ kind="Select">
+ <Parameter name=":ID"/>
+ </Command>
+
+ <Table tableName="CUSTOMER">
+ <Column columnName="ID" primaryKey="true"/>
+ </Table>
+
+ <Table tableName="ANORDER">
+ <Column columnName="ID" primaryKey="true"/>
+ </Table>
+
+ <Relationship name="orders" primaryKeyTable="CUSTOMER"
+ foreignKeyTable="ANORDER" many="true">
+ <KeyPair primaryKeyColumn="ID" foreignKeyColumn="CUSTOMER_ID"/>
+ </Relationship>
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/InvalidConfig1.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/InvalidConfig1.xml
new file mode 100644
index 0000000000..b68ef105c7
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/InvalidConfig1.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <Table tableName="ORDERDETAILS">
+ <Column columnName="ORDERID" primaryKey="true"/>
+ <Column columnName="PRODUCTID" primaryKey="true"/>
+ </Table>
+
+
+ <Relationship name="ORDERDETAILS" primaryKeyTable="xxx"
+ foreignKeyTable="ORDERDETAILS" many="true">
+ <KeyPair primaryKeyColumn="ID" foreignKeyColumn="ORDERID"/>
+ </Relationship>
+
+</Config> \ No newline at end of file
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/ManagedBooksConfig.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/ManagedBooksConfig.xml
new file mode 100644
index 0000000000..c8cd1a4421
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/ManagedBooksConfig.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <Command name="select book 1" SQL="select * from BOOK where BOOK_ID = 1" kind="Select"/>
+ <Command name="update book 1" SQL="update BOOK set OCC = ? where BOOK_ID = 1" kind="Update"/>
+
+ <Table tableName="BOOK">
+ <Column columnName="BOOK_ID" primaryKey="true"/>
+ <Column columnName="OCC" collision="true" managed="true"/>
+ </Table>
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/OrdersOrderDetailsConfig.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/OrdersOrderDetailsConfig.xml
new file mode 100644
index 0000000000..7403e3e30d
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/OrdersOrderDetailsConfig.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <Table tableName="ORDERDETAILS">
+ <Column columnName="ORDERID" primaryKey="true"/>
+ <Column columnName="PRODUCTID" primaryKey="true"/>
+ </Table>
+
+ <Table tableName="ANORDER">
+ <Column columnName="ID" primaryKey="true"/>
+ </Table>
+
+ <Relationship name="ORDERDETAILS" primaryKeyTable="ANORDER"
+ foreignKeyTable="ORDERDETAILS" many="true">
+ <KeyPair primaryKeyColumn="ID" foreignKeyColumn="ORDERID"/>
+ </Relationship>
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/PartsConfig.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/PartsConfig.xml
new file mode 100644
index 0000000000..b51b111841
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/PartsConfig.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <Command name="readEngineParts" kind="Select" SQL="SELECT P1.*, P2.*, P3.* FROM PART AS P1
+ LEFT JOIN PART AS P2 ON P1.ID = P2.PARENT_ID
+ LEFT JOIN PART AS P3 on P2.ID = P3.PARENT_ID WHERE P1.ID = 1">
+ <ResultDescriptor columnName="ID" columnType="commonj.sdo.IntObject" tableName="PART"/>
+ <ResultDescriptor columnName="NAME" columnType="commonj.sdo.String" tableName="PART"/>
+ <ResultDescriptor columnName="QUANTITY" columnType="commonj.sdo.IntObject" tableName="PART"/>
+ <ResultDescriptor columnName="PARENT_ID" columnType="commonj.sdo.IntObject" tableName="PART"/>
+
+ <ResultDescriptor columnName="ID" columnType="commonj.sdo.IntObject" tableName="PART"/>
+ <ResultDescriptor columnName="NAME" columnType="commonj.sdo.String" tableName="PART"/>
+ <ResultDescriptor columnName="QUANTITY" columnType="commonj.sdo.IntObject" tableName="PART"/>
+ <ResultDescriptor columnName="PARENT_ID" columnType="commonj.sdo.IntObject" tableName="PART"/>
+
+ <ResultDescriptor columnName="ID" columnType="commonj.sdo.IntObject" tableName="PART"/>
+ <ResultDescriptor columnName="NAME" columnType="commonj.sdo.String" tableName="PART"/>
+ <ResultDescriptor columnName="QUANTITY" columnType="commonj.sdo.IntObject" tableName="PART"/>
+ <ResultDescriptor columnName="PARENT_ID" columnType="commonj.sdo.IntObject" tableName="PART"/>
+
+ </Command>
+
+ <Table tableName="PART">
+ <Column columnName="ID" primaryKey="true"/>
+ </Table>
+
+ <Relationship name="subparts" primaryKeyTable="PART" foreignKeyTable="PART" many="true">
+ <KeyPair primaryKeyColumn="ID" foreignKeyColumn="PARENT_ID"/>
+ </Relationship>
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCompanyDepartmentMapping.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCompanyDepartmentMapping.xml
new file mode 100644
index 0000000000..f6d760386b
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCompanyDepartmentMapping.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <Table tableName="COMPANY">
+ <Column columnName="ID" primaryKey="true" generated="true"/>
+ <Column columnName="NAME"/>
+ </Table>
+
+ <Table tableName="DEPARTMENT">
+ <Column columnName="ID" primaryKey="true" generated="true"/>
+ <Column columnName="NAME"/>
+ <Column columnName="NUMBER"/>
+ <Column columnName="COMPANYID"/>
+ <Column columnName="EOTM"/>
+ </Table>
+
+ <Relationship name="departments" primaryKeyTable="COMPANY" foreignKeyTable="DEPARTMENT" many="true">
+ <KeyPair primaryKeyColumn="ID" foreignKeyColumn="COMPANYID"/>
+ </Relationship>
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCompanyMapping.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCompanyMapping.xml
new file mode 100644
index 0000000000..0455ad8445
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCompanyMapping.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <Table tableName="COMPANY">
+ <Column columnName="ID" primaryKey="true" generated="true"/>
+ <Column columnName="NAME"/>
+ </Table>
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCustomerMapping.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCustomerMapping.xml
new file mode 100644
index 0000000000..1713026a62
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCustomerMapping.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <Table tableName="CUSTOMER">
+ <Column columnName="ID" primaryKey="true"/>
+ <Column columnName="LASTNAME"/>
+ <Column columnName="ADDRESS"/>
+ </Table>
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCustomerMappingWithCUD.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCustomerMappingWithCUD.xml
new file mode 100644
index 0000000000..8cb5137728
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCustomerMappingWithCUD.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <Table tableName="CUSTOMER">
+ <create sql="insert into customer values (?, ?, ?)" parameters="ID LASTNAME ADDRESS"/>
+ <update sql="update customer set lastname = ?, address = ? where ID = ?" parameters="LASTNAME ADDRESS ID"/>
+ <delete sql="delete from customer where ID = ?" parameters="ID"/>
+ </Table>
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCustomerMappingWithCUD2.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCustomerMappingWithCUD2.xml
new file mode 100644
index 0000000000..bc6b8c278b
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCustomerMappingWithCUD2.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <Table tableName="CUSTOMER">
+ <create sql="insert into customer values (?, ?, ?)" parameters="ID LASTNAME ADDRESS"/>
+ <update sql="update customer set lastname = ? where ID = ?" parameters="LASTNAME ID"/>
+ <delete sql="delete from customer where ID = ?" parameters="ID"/>
+ <Column columnName="ID" primaryKey="true"/>
+ <Column columnName="LASTNAME"/>
+ <Column columnName="ADDRESS"/>
+ </Table>
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCustomerMappingWithInvalidCUD.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCustomerMappingWithInvalidCUD.xml
new file mode 100644
index 0000000000..4b66281489
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCustomerMappingWithInvalidCUD.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <Table tableName="CUSTOMER">
+ <create sql="insert into customer blah values (?, ?, ?)" parameters="ID LASTNAME ADDRESS"/>
+ <update sql="update customer blah set lastname = ?, address = ? where ID = ?" parameters="LASTNAME ADDRESS ID"/>
+ <delete sql="delete from customer blah where ID = ?" parameters="ID"/>
+
+ <Column columnName="ID" primaryKey="true"/>
+ <Column columnName="LASTNAME"/>
+ <Column columnName="ADDRESS"/>
+ </Table>
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCustomerOrderMapping.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCustomerOrderMapping.xml
new file mode 100644
index 0000000000..f7bb65934c
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicCustomerOrderMapping.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <Table tableName="CUSTOMER">
+ <Column columnName="ID" primaryKey="true"/>
+ </Table>
+ <Table tableName="ANORDER">
+ <Column columnName="ID" primaryKey="true"/>
+ <Column columnName="CUSTOMER_ID"/>
+ </Table>
+
+ <Relationship name="orders" primaryKeyTable="CUSTOMER" foreignKeyTable="ANORDER" many="true">
+ <KeyPair primaryKeyColumn="ID" foreignKeyColumn="CUSTOMER_ID"/>
+ </Relationship>
+
+</Config>
+
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicStaticCustomer.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicStaticCustomer.xml
new file mode 100644
index 0000000000..65e5bea7da
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/basicStaticCustomer.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+dataObjectModel="http:///org.apache.tuscany.das.rdb.test/customer.xsd">
+
+ <Table tableName="CUSTOMER" typeName="Customer">
+ <Column columnName="ID" primaryKey="true"/>
+ <Column columnName="LASTNAME"/>
+ <Column columnName="ADDRESS"/>
+ </Table>
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/cityStates.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/cityStates.xml
new file mode 100644
index 0000000000..d8fe1261ab
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/cityStates.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <Table tableName="STATES">
+ <Column columnName="ID" primaryKey="true"/>
+ <Column columnName="NAME"/>
+ </Table>
+
+ <Table tableName="CITIES">
+
+ <Column columnName="ID" primaryKey="true"/>
+ <Column columnName="NAME"/>
+ <Column columnName="STATE_ID"/>
+
+ </Table>
+
+ <Relationship name="cities" primaryKeyTable="STATES" foreignKeyTable="CITIES" many="true">
+ <KeyPair primaryKeyColumn="ID" foreignKeyColumn="STATE_ID"/>
+ </Relationship>
+
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/company.ecore b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/company.ecore
new file mode 100644
index 0000000000..888acdf1c3
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/company.ecore
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="company"
+ nsURI="org.apache.tuscany.das.rdb.test/company.xsd" nsPrefix="company">
+ <eClassifiers xsi:type="ecore:EClass" name="CompanyType">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="name" value="CompanyType"/>
+ <details key="kind" value="elementOnly"/>
+ </eAnnotations>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="departments" lowerBound="1"
+ upperBound="-1" eType="#//DepartmentType" containment="true" resolveProxies="false">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="element"/>
+ <details key="name" value="departments"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="employeeOfTheMonth" unique="false"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//IDREF">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="attribute"/>
+ <details key="name" value="employeeOfTheMonth"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="attribute"/>
+ <details key="name" value="name"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="DepartmentType">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="name" value="DepartmentType"/>
+ <details key="kind" value="elementOnly"/>
+ </eAnnotations>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="employees" lowerBound="1"
+ upperBound="-1" eType="#//EmployeeType" containment="true" resolveProxies="false">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="element"/>
+ <details key="name" value="employees"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="location" unique="false"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="attribute"/>
+ <details key="name" value="location"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="attribute"/>
+ <details key="name" value="name"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="number" unique="false"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Int" unsettable="true">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="attribute"/>
+ <details key="name" value="number"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="DocumentRoot">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="name" value=""/>
+ <details key="kind" value="mixed"/>
+ </eAnnotations>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="mixed" unique="false" upperBound="-1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="elementWildcard"/>
+ <details key="name" value=":mixed"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="xMLNSPrefixMap" upperBound="-1"
+ eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EStringToStringMapEntry"
+ transient="true" containment="true" resolveProxies="false">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="attribute"/>
+ <details key="name" value="xmlns:prefix"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="xSISchemaLocation" upperBound="-1"
+ eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EStringToStringMapEntry"
+ transient="true" containment="true" resolveProxies="false">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="attribute"/>
+ <details key="name" value="xsi:schemaLocation"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="company" upperBound="-2"
+ eType="#//CompanyType" volatile="true" transient="true" derived="true" containment="true"
+ resolveProxies="false">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="element"/>
+ <details key="name" value="company"/>
+ <details key="namespace" value="##targetNamespace"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="EmployeeType">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="name" value="EmployeeType"/>
+ <details key="kind" value="empty"/>
+ </eAnnotations>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="manager" unique="false"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Boolean"
+ unsettable="true">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="attribute"/>
+ <details key="name" value="manager"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="attribute"/>
+ <details key="name" value="name"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="sN" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//ID"
+ iD="true">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="attribute"/>
+ <details key="name" value="SN"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/company.genmodel b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/company.genmodel
new file mode 100644
index 0000000000..0b89c2c0c8
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/company.genmodel
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<genmodel:GenModel xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/rdbdas2/src/test/java"
+ modelPluginID="das.tests" modelName="Company" rootExtendsInterface="" rootExtendsClass="org.eclipse.emf.ecore.sdo.impl.EDataObjectImpl"
+ rootImplementsInterface="org.eclipse.emf.ecore.sdo.InternalEDataObject" suppressEMFTypes="true"
+ suppressEMFMetaData="true" featureMapWrapperInterface="commonj.sdo.Sequence" featureMapWrapperInternalInterface="org.eclipse.emf.ecore.sdo.util.ESequence"
+ featureMapWrapperClass="org.eclipse.emf.ecore.sdo.util.BasicESequence" importerID="org.eclipse.xsd.ecore.importer">
+ <foreignModel>company.xsd</foreignModel>
+ <staticPackages>http://www.eclipse.org/emf/2003/SDO</staticPackages>
+ <modelPluginVariables>EMF_COMMONJ_SDO=org.eclipse.emf.commonj.sdo</modelPluginVariables>
+ <modelPluginVariables>EMF_ECORE_SDO=org.eclipse.emf.ecore.sdo</modelPluginVariables>
+ <genPackages prefix="Company" basePackage="org.apache.tuscany.das.rdb.test" resource="XML"
+ disposableProviderFactory="true" ecorePackage="company.ecore#/">
+ <genClasses ecoreClass="company.ecore#//CompanyType">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference company.ecore#//CompanyType/departments"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute company.ecore#//CompanyType/employeeOfTheMonth"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute company.ecore#//CompanyType/name"/>
+ </genClasses>
+ <genClasses ecoreClass="company.ecore#//DepartmentType">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference company.ecore#//DepartmentType/employees"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute company.ecore#//DepartmentType/location"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute company.ecore#//DepartmentType/name"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute company.ecore#//DepartmentType/number"/>
+ </genClasses>
+ <genClasses ecoreClass="company.ecore#//DocumentRoot">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute company.ecore#//DocumentRoot/mixed"/>
+ <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference company.ecore#//DocumentRoot/xMLNSPrefixMap"/>
+ <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference company.ecore#//DocumentRoot/xSISchemaLocation"/>
+ <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference company.ecore#//DocumentRoot/company"/>
+ </genClasses>
+ <genClasses ecoreClass="company.ecore#//EmployeeType">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute company.ecore#//EmployeeType/manager"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute company.ecore#//EmployeeType/name"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute company.ecore#//EmployeeType/sN"/>
+ </genClasses>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/company.xsd b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/company.xsd
new file mode 100644
index 0000000000..42cf60c588
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/company.xsd
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<xsd:schema targetNamespace="org.apache.tuscany.das.rdb.test/company.xsd"
+ xmlns:company="org.apache.tuscany.das.rdb.test/company.xsd"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore">
+
+ <xsd:element name="company" type="company:CompanyType"/>
+
+ <xsd:complexType name="CompanyType">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" name="departments" type="company:DepartmentType"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="employeeOfTheMonth" type="xsd:IDREF" ecore:reference="EmployeeType"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="DepartmentType">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" name="employees" type="company:EmployeeType"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="location" type="xsd:string"/>
+ <xsd:attribute name="number" type="xsd:int"/>
+ </xsd:complexType>
+ <xsd:complexType name="EmployeeType">
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="SN" type="xsd:ID"/>
+ <xsd:attribute name="manager" type="xsd:boolean"/>
+ </xsd:complexType>
+ </xsd:schema>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/companyMapping.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/companyMapping.xml
new file mode 100644
index 0000000000..76ff87a095
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/companyMapping.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <Table tableName="COMPANY" typeName="CompanyType">
+ <Column columnName="ID" primaryKey="true"/>
+ </Table>
+
+ <Table tableName="DEPARTMENT" typeName="DepartmentType">
+ <Column columnName="ID" primaryKey="true"/>
+ </Table>
+
+ <Table tableName="EMPLOYEE" typeName="EmployeeType">
+ <Column columnName="ID" primaryKey="true"/>
+ </Table>
+
+ <Relationship name="departments" primaryKeyTable="COMPANY" foreignKeyTable="DEPARTMENT" many="true">
+ <KeyPair primaryKeyColumn="ID" foreignKeyColumn="COMPANYID"/>
+ </Relationship>
+
+ <Relationship name="employees" primaryKeyTable="DEPARTMENT" foreignKeyTable="EMPLOYEE" many="true">
+ <KeyPair primaryKeyColumn="ID" foreignKeyColumn="DEPARTMENTID"/>
+ </Relationship>
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/companyMappingWithConverters.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/companyMappingWithConverters.xml
new file mode 100644
index 0000000000..d51e74a824
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/companyMappingWithConverters.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+dataObjectModel="org.apache.tuscany.das.rdb.test/company.xsd">
+
+ <Table tableName="COMPANY" typeName="CompanyType">
+ <Column columnName="ID" primaryKey="true"/>
+ </Table>
+
+ <Table tableName="DEPARTMENT" typeName="DepartmentType">
+ <Column columnName="ID" primaryKey="true"/>
+ <Column columnName="NUMBER" converterClassName="org.apache.tuscany.das.rdb.test.mappings.StringToIntegerConverter"/>
+ </Table>
+
+ <Table tableName="EMPLOYEE" typeName="EmployeeType">
+ <Column columnName="ID" primaryKey="true"/>
+ <Column columnName="MANAGER" converterClassName="org.apache.tuscany.das.rdb.test.mappings.IntegerToBooleanConverter"/>
+ </Table>
+
+ <Relationship name="departments" primaryKeyTable="COMPANY" foreignKeyTable="DEPARTMENT" many="true">
+ <KeyPair primaryKeyColumn="ID" foreignKeyColumn="COMPANYID"/>
+ </Relationship>
+
+ <Relationship name="employees" primaryKeyTable="DEPARTMENT" foreignKeyTable="EMPLOYEE" many="true">
+ <KeyPair primaryKeyColumn="ID" foreignKeyColumn="DEPARTMENTID"/>
+ </Relationship>
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/customer.ecore b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/customer.ecore
new file mode 100644
index 0000000000..74786d8af4
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/customer.ecore
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="customer"
+ nsURI="http:///org.apache.tuscany.das.rdb.test/customer.xsd" nsPrefix="customer">
+ <eClassifiers xsi:type="ecore:EClass" name="AnOrder">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="name" value="AnOrder"/>
+ <details key="kind" value="elementOnly"/>
+ </eAnnotations>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="iD" unique="false" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Int" unsettable="true">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="element"/>
+ <details key="name" value="ID"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="product" unique="false"
+ lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="element"/>
+ <details key="name" value="Product"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="quantity" unique="false"
+ lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Int"
+ unsettable="true">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="element"/>
+ <details key="name" value="Quantity"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="customerID" unique="false"
+ lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Int"
+ unsettable="true">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="element"/>
+ <details key="name" value="Customer_ID"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Customer">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="name" value="Customer"/>
+ <details key="kind" value="elementOnly"/>
+ </eAnnotations>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="iD" unique="false" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Int" unsettable="true">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="element"/>
+ <details key="name" value="ID"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="lastName" unique="false"
+ lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="element"/>
+ <details key="name" value="lastName"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="address" unique="false"
+ lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="element"/>
+ <details key="name" value="address"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="orders" lowerBound="1"
+ upperBound="-1" eType="#//AnOrder" containment="true" resolveProxies="false">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="element"/>
+ <details key="name" value="orders"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="DataGraphRoot">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="name" value="DataGraphRoot"/>
+ <details key="kind" value="elementOnly"/>
+ </eAnnotations>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="customers" upperBound="-1"
+ eType="#//Customer" containment="true" resolveProxies="false">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="element"/>
+ <details key="name" value="customers"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="orders" upperBound="-1"
+ eType="#//AnOrder" containment="true" resolveProxies="false">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="element"/>
+ <details key="name" value="orders"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/customer.genmodel b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/customer.genmodel
new file mode 100644
index 0000000000..8c1cd53e57
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/customer.genmodel
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<genmodel:GenModel xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/rdbdas2/src"
+ modelPluginID="rdbdas2" modelName="Customer" rootExtendsInterface="" rootExtendsClass="org.eclipse.emf.ecore.sdo.impl.EDataObjectImpl"
+ rootImplementsInterface="org.eclipse.emf.ecore.sdo.InternalEDataObject" suppressEMFTypes="true"
+ suppressEMFMetaData="true" featureMapWrapperInterface="commonj.sdo.Sequence" featureMapWrapperInternalInterface="org.eclipse.emf.ecore.sdo.util.ESequence"
+ featureMapWrapperClass="org.eclipse.emf.ecore.sdo.util.BasicESequence" importerID="org.eclipse.xsd.ecore.importer">
+ <foreignModel>customer.xsd</foreignModel>
+ <staticPackages>http://www.eclipse.org/emf/2003/SDO</staticPackages>
+ <modelPluginVariables>EMF_COMMONJ_SDO=org.eclipse.emf.commonj.sdo</modelPluginVariables>
+ <modelPluginVariables>EMF_ECORE_SDO=org.eclipse.emf.ecore.sdo</modelPluginVariables>
+ <genPackages prefix="Customer" basePackage="org.apache.tuscany.das.rdb.test" resource="XML"
+ disposableProviderFactory="true" ecorePackage="customer.ecore#/">
+ <genClasses ecoreClass="customer.ecore#//AnOrder">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute customer.ecore#//AnOrder/iD"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute customer.ecore#//AnOrder/product"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute customer.ecore#//AnOrder/quantity"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute customer.ecore#//AnOrder/customerID"/>
+ </genClasses>
+ <genClasses ecoreClass="customer.ecore#//Customer">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute customer.ecore#//Customer/iD"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute customer.ecore#//Customer/lastName"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute customer.ecore#//Customer/address"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference customer.ecore#//Customer/orders"/>
+ </genClasses>
+ <genClasses ecoreClass="customer.ecore#//DataGraphRoot">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference customer.ecore#//DataGraphRoot/customers"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference customer.ecore#//DataGraphRoot/orders"/>
+ </genClasses>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/customer.xsd b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/customer.xsd
new file mode 100644
index 0000000000..18a87aa299
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/customer.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:this="http:///org.apache.tuscany.das.rdb.test/customer.xsd" targetNamespace="http:///org.apache.tuscany.das.rdb.test/customer.xsd">
+
+ <xsd:complexType name="Customer">
+ <xsd:sequence>
+ <xsd:element name="ID" nillable="false" type="xsd:int"/>
+ <xsd:element name="lastName" type="xsd:string"/>
+ <xsd:element name="address" type="xsd:string"/>
+ <xsd:element maxOccurs="unbounded" name="orders" type="this:AnOrder"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+ <!-- An Order -->
+ <xsd:complexType name="AnOrder">
+ <xsd:sequence>
+ <xsd:element name="ID" nillable="false" type="xsd:int"/>
+ <xsd:element name="Product" type="xsd:string"/>
+ <xsd:element name="Quantity" type="xsd:int"/>
+ <xsd:element name="Customer_ID" type="xsd:int"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+</xsd:schema>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/customerMapping.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/customerMapping.xml
new file mode 100644
index 0000000000..93c278dbe1
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/customerMapping.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <Table tableName="CUSTOMER" typeName="Customer">
+ <Column columnName="ID" propertyName="id" primaryKey="true"/>
+ <Column columnName="LASTNAME" propertyName="lastname"/>
+ <Column columnName="ADDRESS" propertyName="address"/>
+ </Table>
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/customerOrderRelationshipMapping.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/customerOrderRelationshipMapping.xml
new file mode 100644
index 0000000000..a32d50dcd0
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/customerOrderRelationshipMapping.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <Table tableName="CUSTOMER">
+ <Column columnName="ID" primaryKey="true"/>
+ </Table>
+ <Table tableName="ANORDER">
+ <Column columnName="ID" primaryKey="true"/>
+ </Table>
+
+ <Relationship name="orders" primaryKeyTable="CUSTOMER" foreignKeyTable="ANORDER" many="true">
+ <KeyPair primaryKeyColumn="ID" foreignKeyColumn="CUSTOMER_ID"/>
+ </Relationship>
+
+</Config>
+
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/passiveConnection.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/passiveConnection.xml
new file mode 100644
index 0000000000..d6a7d83885
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/passiveConnection.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <ConnectionInfo managedtx="false"/>
+
+ <Command name="get a customer" SQL="Select * from CUSTOMER where ID = 1" kind="select"/>
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/staticCustomer.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/staticCustomer.xml
new file mode 100644
index 0000000000..78f2409022
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/staticCustomer.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+dataObjectModel="http:///org.apache.tuscany.das.rdb.test/customer.xsd">
+
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/staticCustomerOrder.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/staticCustomerOrder.xml
new file mode 100644
index 0000000000..13e0ae350f
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/staticCustomerOrder.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+dataObjectModel="http:///org.apache.tuscany.das.rdb.test/customer.xsd">
+
+ <Command name="Customer and Orders" SQL="SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = ?" kind="Select"/>
+
+ <Table tableName="CUSTOMER" typeName="Customer">
+ <Column columnName="ID" primaryKey="true"/>
+ </Table>
+ <Table tableName="ANORDER" typeName="AnOrder">
+ <Column columnName="ID" primaryKey="true"/>
+ <Column columnName="CUSTOMER_ID"/>
+ </Table>
+
+ <Relationship name="orders" primaryKeyTable="CUSTOMER" foreignKeyTable="ANORDER" many="true">
+ <KeyPair primaryKeyColumn="ID" foreignKeyColumn="CUSTOMER_ID"/>
+ </Relationship>
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/staticInvalid.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/staticInvalid.xml
new file mode 100644
index 0000000000..d0571b8a14
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/staticInvalid.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+dataObjectModel="invalidURI">
+
+
+</Config>
diff --git a/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/storedProcTest.xml b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/storedProcTest.xml
new file mode 100644
index 0000000000..1412aedf7f
--- /dev/null
+++ b/sca-java-1.x/branches/java-post-M1/das/rdb/src/test/resources/storedProcTest.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <Command name="getNamedCustomers" SQL="{call GETNAMEDCUSTOMERS(?,?)}" kind="procedure">
+ <Parameter name="name" direction="IN" columnType="commonj.sdo.String"/>
+ <Parameter name="number" direction="OUT" columnType="commonj.sdo.IntObject"/>
+ </Command>
+
+</Config>