From c6103c7c9a6b6971d2aa0b8e3997608cb5f2c36f Mon Sep 17 00:00:00 2001 From: lresende Date: Mon, 2 Nov 2009 22:22:29 +0000 Subject: Move the das folder as new trunk for das sub project git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@832144 13f79535-47bb-0310-9956-ffa450edef68 --- das-java/trunk/distribution/binary/DISCLAIMER | 7 + das-java/trunk/distribution/binary/LICENSE | 353 ++ das-java/trunk/distribution/binary/NOTICE | 24 + das-java/trunk/distribution/binary/README | 10 + das-java/trunk/distribution/binary/RELEASE_NOTES | 33 + das-java/trunk/distribution/binary/pom.xml | 98 + .../distribution/binary/src/main/assembly/das.xml | 174 + das-java/trunk/distribution/source/BUILDING | 47 + das-java/trunk/distribution/source/DISCLAIMER | 7 + das-java/trunk/distribution/source/LICENSE | 353 ++ das-java/trunk/distribution/source/NOTICE | 24 + das-java/trunk/distribution/source/README | 10 + das-java/trunk/distribution/source/RELEASE_NOTES | 33 + das-java/trunk/distribution/source/pom.xml | 66 + .../distribution/source/src/main/assembly/src.xml | 63 + das-java/trunk/plugin/pom.xml | 107 + .../apache/tuscany/das/plugin/GeneratorMojo.java | 111 + das-java/trunk/pom.xml | 160 + das-java/trunk/rdb/pom.xml | 272 ++ .../java/org/apache/tuscany/das/rdb/Command.java | 138 + .../org/apache/tuscany/das/rdb/ConfigHelper.java | 318 ++ .../java/org/apache/tuscany/das/rdb/Converter.java | 54 + .../main/java/org/apache/tuscany/das/rdb/DAS.java | 67 + .../org/apache/tuscany/das/rdb/DASFactory.java | 74 + .../java/org/apache/tuscany/das/rdb/Pager.java | 64 + .../das/rdb/config/wrapper/MappingWrapper.java | 945 ++++ .../das/rdb/config/wrapper/QualifiedColumn.java | 94 + .../rdb/config/wrapper/RelationshipWrapper.java | 50 + .../das/rdb/config/wrapper/TableWrapper.java | 149 + .../DataSourceInitializationException.java | 36 + .../exception/OptimisticConcurrencyException.java | 31 + .../das/rdb/generator/impl/BaseGenerator.java | 36 + .../das/rdb/generator/impl/DeleteGenerator.java | 91 + .../das/rdb/generator/impl/InsertGenerator.java | 182 + .../das/rdb/generator/impl/UpdateGenerator.java | 271 ++ .../das/rdb/graphbuilder/impl/DataObjectMaker.java | 123 + .../rdb/graphbuilder/impl/DefaultConverter.java | 84 + .../graphbuilder/impl/GraphBuilderMetadata.java | 283 ++ .../rdb/graphbuilder/impl/MultiTableRegistry.java | 116 + .../das/rdb/graphbuilder/impl/ResultMetadata.java | 411 ++ .../rdb/graphbuilder/impl/ResultSetProcessor.java | 180 + .../das/rdb/graphbuilder/impl/ResultSetRow.java | 390 ++ .../das/rdb/graphbuilder/impl/RowObjects.java | 205 + .../rdb/graphbuilder/impl/SingleTableRegistry.java | 49 + .../das/rdb/graphbuilder/impl/TableData.java | 123 + .../das/rdb/graphbuilder/impl/TableRegistry.java | 47 + .../rdb/graphbuilder/schema/ResultSetTypeMap.java | 137 + .../das/rdb/impl/ApplyChangesCommandImpl.java | 79 + .../tuscany/das/rdb/impl/BaseCommandImpl.java | 62 + .../apache/tuscany/das/rdb/impl/ChangeFactory.java | 189 + .../tuscany/das/rdb/impl/ChangeOperation.java | 87 + .../tuscany/das/rdb/impl/ChangeSummarizer.java | 268 ++ .../org/apache/tuscany/das/rdb/impl/Changes.java | 82 + .../tuscany/das/rdb/impl/CollisionParameter.java | 31 + .../apache/tuscany/das/rdb/impl/CommandImpl.java | 160 + .../tuscany/das/rdb/impl/ConnectionImpl.java | 154 + .../tuscany/das/rdb/impl/CreateOperation.java | 30 + .../tuscany/das/rdb/impl/DASFactoryImpl.java | 50 + .../org/apache/tuscany/das/rdb/impl/DASImpl.java | 327 ++ .../tuscany/das/rdb/impl/DatabaseObject.java | 229 + .../tuscany/das/rdb/impl/DeleteCommandImpl.java | 37 + .../apache/tuscany/das/rdb/impl/DeleteList.java | 77 + .../tuscany/das/rdb/impl/DeleteOperation.java | 38 + .../tuscany/das/rdb/impl/FactoryRegistry.java | 57 + .../tuscany/das/rdb/impl/InsertCommandImpl.java | 75 + .../apache/tuscany/das/rdb/impl/InsertList.java | 95 + .../tuscany/das/rdb/impl/ManagedParameterImpl.java | 39 + .../das/rdb/impl/OptimisticWriteCommandImpl.java | 48 + .../org/apache/tuscany/das/rdb/impl/PagerImpl.java | 69 + .../das/rdb/impl/ParameterExtendedImpl.java | 99 + .../apache/tuscany/das/rdb/impl/ParameterImpl.java | 120 + .../apache/tuscany/das/rdb/impl/Parameters.java | 113 + .../das/rdb/impl/ParametersExtendedImpl.java | 189 + .../tuscany/das/rdb/impl/ReadCommandImpl.java | 338 ++ .../tuscany/das/rdb/impl/ResultSetShape.java | 161 + .../tuscany/das/rdb/impl/SDODataTypeHelper.java | 189 + .../apache/tuscany/das/rdb/impl/SDODataTypes.java | 130 + .../apache/tuscany/das/rdb/impl/SPCommandImpl.java | 100 + .../org/apache/tuscany/das/rdb/impl/Statement.java | 233 + .../tuscany/das/rdb/impl/UpdateCommandImpl.java | 37 + .../apache/tuscany/das/rdb/impl/UpdateList.java | 45 + .../tuscany/das/rdb/impl/UpdateOperation.java | 32 + .../tuscany/das/rdb/impl/WriteCommandImpl.java | 165 + .../tuscany/das/rdb/merge/impl/GraphMerger.java | 391 ++ .../tuscany/das/rdb/util/CollectionsUtil.java | 49 + .../apache/tuscany/das/rdb/util/ConfigUtil.java | 130 + .../tuscany/das/rdb/util/DataObjectUtil.java | 79 + .../rdb/src/main/resources/META-INF/DISCLAIMER | 7 + .../trunk/rdb/src/main/resources/META-INF/LICENSE | 353 ++ .../trunk/rdb/src/main/resources/META-INF/NOTICE | 32 + .../trunk/rdb/src/main/resources/META-INF/README | 35 + das-java/trunk/rdb/src/main/resources/config.xsd | 152 + .../trunk/rdb/src/main/resources/dasmodel4.mdl | 4622 ++++++++++++++++++++ .../apache/tuscany/das/rdb/test/AliasTests.java | 186 + .../tuscany/das/rdb/test/BestPracticeTests.java | 153 + .../apache/tuscany/das/rdb/test/CUDGeneration.java | 111 + .../das/rdb/test/CheckSupportGeneratedKeys.java | 167 + .../tuscany/das/rdb/test/CommandGroupTests.java | 161 + .../apache/tuscany/das/rdb/test/CompanyTests.java | 171 + .../das/rdb/test/CompoundKeyRelationshipTests.java | 265 ++ .../tuscany/das/rdb/test/CompoundKeyTests.java | 109 + .../tuscany/das/rdb/test/ConnectionTests.java | 89 + .../tuscany/das/rdb/test/ConverterTests.java | 222 + .../tuscany/das/rdb/test/CorrectedDefectTests.java | 304 ++ .../das/rdb/test/CrudWithChangeHistory.java | 405 ++ .../apache/tuscany/das/rdb/test/DefectTests.java | 115 + .../das/rdb/test/DynamicResultDescriptorTests.java | 351 ++ .../tuscany/das/rdb/test/ExceptionTests.java | 153 + .../das/rdb/test/GeneratedCommandTests.java | 94 + .../apache/tuscany/das/rdb/test/GeneratedId.java | 313 ++ .../tuscany/das/rdb/test/GraphMergeTests.java | 625 +++ .../das/rdb/test/ImpliedRelationshipTests.java | 112 + .../apache/tuscany/das/rdb/test/KennelTests.java | 123 + .../org/apache/tuscany/das/rdb/test/LOBTests.java | 96 + .../tuscany/das/rdb/test/MissingPKTests.java | 350 ++ .../tuscany/das/rdb/test/MultiSchemaTests.java | 715 +++ .../tuscany/das/rdb/test/NamedParameterTests.java | 241 + .../org/apache/tuscany/das/rdb/test/OCCTests.java | 163 + .../das/rdb/test/OneToOneRelationshipTests.java | 174 + .../das/rdb/test/OperationOrderingTests.java | 124 + .../org/apache/tuscany/das/rdb/test/Paging.java | 134 + .../tuscany/das/rdb/test/PartialUpdateTests.java | 267 ++ .../das/rdb/test/PassiveConnectionTests.java | 148 + .../das/rdb/test/ProgrammaticConfigTests.java | 432 ++ .../tuscany/das/rdb/test/ReadDBSchemaTests.java | 55 + .../tuscany/das/rdb/test/RecursiveTests.java | 71 + .../tuscany/das/rdb/test/RelationshipTests.java | 729 +++ .../tuscany/das/rdb/test/ResultSetShapeTests.java | 91 + .../tuscany/das/rdb/test/SerializationTests.java | 76 + .../apache/tuscany/das/rdb/test/SimplestCrud.java | 228 + .../apache/tuscany/das/rdb/test/StoredProcs.java | 142 + .../org/apache/tuscany/das/rdb/test/TopDown.java | 75 + .../tuscany/das/rdb/test/TransactionTests.java | 87 + .../org/apache/tuscany/das/rdb/test/TypeTests.java | 108 + .../commands/ReadCustomersByLastnameCommand.java | 56 + .../rdb/test/commands/ReadCustomersCommand.java | 57 + .../commands/ReadCustomersStaticTypesCommand.java | 66 + .../commands/ReadCustomersWithShapeCommand.java | 63 + .../SimpleReadCustomersWithShapeCommand.java | 83 + .../apache/tuscany/das/rdb/test/data/BookData.java | 46 + .../apache/tuscany/das/rdb/test/data/CityData.java | 54 + .../tuscany/das/rdb/test/data/CompanyData.java | 44 + .../tuscany/das/rdb/test/data/CompanyDeptData.java | 41 + .../tuscany/das/rdb/test/data/CompanyEmpData.java | 45 + .../tuscany/das/rdb/test/data/CustomerData.java | 39 + .../tuscany/das/rdb/test/data/DepEmpData.java | 43 + .../tuscany/das/rdb/test/data/DepartmentData.java | 44 + .../das/rdb/test/data/DocumentsImagesData.java | 82 + .../apache/tuscany/das/rdb/test/data/DogData.java | 54 + .../tuscany/das/rdb/test/data/EmployeeData.java | 46 + .../tuscany/das/rdb/test/data/KennelData.java | 53 + .../tuscany/das/rdb/test/data/MultiSchemaData.java | 99 + .../tuscany/das/rdb/test/data/OrderData.java | 41 + .../das/rdb/test/data/OrderDetailsData.java | 43 + .../rdb/test/data/OrderDetailsDescriptionData.java | 47 + .../tuscany/das/rdb/test/data/OwnerData.java | 53 + .../tuscany/das/rdb/test/data/OwnerDogData.java | 41 + .../apache/tuscany/das/rdb/test/data/PartData.java | 48 + .../tuscany/das/rdb/test/data/ProductData.java | 41 + .../das/rdb/test/data/ProductProdSpecData.java | 44 + .../tuscany/das/rdb/test/data/ProductSpecData.java | 41 + .../tuscany/das/rdb/test/data/SingerData.java | 44 + .../apache/tuscany/das/rdb/test/data/SongData.java | 45 + .../tuscany/das/rdb/test/data/StateData.java | 48 + .../tuscany/das/rdb/test/data/TypesData.java | 38 + .../tuscany/das/rdb/test/data/VisitData.java | 52 + .../tuscany/das/rdb/test/framework/DB2Setup.java | 37 + .../tuscany/das/rdb/test/framework/DasTest.java | 147 + .../das/rdb/test/framework/DatabaseSetup.java | 572 +++ .../tuscany/das/rdb/test/framework/DerbySetup.java | 44 + .../das/rdb/test/framework/JavaStoredProcs.java | 97 + .../tuscany/das/rdb/test/framework/MySQLSetup.java | 105 + .../das/rdb/test/framework/RelationshipData.java | 80 + .../tuscany/das/rdb/test/framework/TestData.java | 126 + .../framework/TestDataWithExplicitColumns.java | 87 + .../test/mappings/IntegerToBooleanConverter.java | 43 + .../test/mappings/SillyDateStringConverter.java | 77 + .../test/mappings/StringObfuscationConverter.java | 65 + .../test/mappings/StringToIntegerConverter.java | 39 + .../rdb/test/mappings/StringToLongConverter.java | 37 + .../das/rdb/test/suites/AllCommonTests.java | 127 + .../tuscany/das/rdb/test/suites/AllTestsDB2.java | 44 + .../tuscany/das/rdb/test/suites/AllTestsDerby.java | 35 + .../tuscany/das/rdb/test/suites/AllTestsMySQL.java | 39 + .../das/rdb/test/typed/SimplestStaticCrud.java | 58 + .../rdb/test/util/PrintPropertiesOfDataObject.java | 134 + .../rdb/src/test/resources/1xM_mapping_no_cud.xml | 36 + .../trunk/rdb/src/test/resources/BooksConfig.xml | 30 + .../src/test/resources/BooksConfigWithAlias.xml | 36 + .../trunk/rdb/src/test/resources/CompanyConfig.xml | 43 + .../src/test/resources/CompanyEmployeeConfig.xml | 54 + .../rdb/src/test/resources/CustomerConfig.xml | 24 + .../test/resources/CustomerConfigWithConverter.xml | 33 + .../resources/CustomerConfigWithConverter2.xml | 29 + .../resources/CustomerConfigWithIDConverter.xml | 32 + .../src/test/resources/CustomersOrdersConfig.xml | 51 + .../test/resources/CustomersOrdersConfigProps.xml | 53 + .../test/resources/CustomersOrdersRelationship.xml | 53 + .../rdb/src/test/resources/InvalidConfig1.xml | 32 + .../rdb/src/test/resources/InvalidConverter.xml | 36 + .../rdb/src/test/resources/ManagedBooksConfig.xml | 30 + .../trunk/rdb/src/test/resources/MissingPK.xml | 59 + .../trunk/rdb/src/test/resources/MissingPKREL.xml | 63 + .../src/test/resources/MultiSchemaDasConfig1.xml | 36 + .../src/test/resources/MultiSchemaDasConfig12.xml | 33 + .../src/test/resources/MultiSchemaDasConfig13.xml | 34 + .../src/test/resources/MultiSchemaDasConfig14.xml | 37 + .../src/test/resources/MultiSchemaDasConfig2.xml | 45 + .../src/test/resources/MultiSchemaDasConfig3.xml | 32 + .../src/test/resources/MultiSchemaDasConfig5.xml | 32 + .../src/test/resources/MultiSchemaDasConfig6.xml | 38 + .../src/test/resources/MultiSchemaDasConfig7.xml | 26 + .../src/test/resources/MultiSchemaDasConfig8.xml | 34 + .../src/test/resources/MultiSchemaDasConfig9.xml | 30 + .../test/resources/MultiSchemaInvalidDasConfig.xml | 47 + .../test/resources/OneToOneNonRestrictedConfig.xml | 51 + .../test/resources/OneToOneRestrictedConfig.xml | 69 + .../test/resources/OrderDetailsAndDescription.xml | 35 + .../test/resources/OrdersOrderDetailsConfig.xml | 36 + .../trunk/rdb/src/test/resources/PartsConfig.xml | 50 + das-java/trunk/rdb/src/test/resources/SINGER.xsd | 39 + .../trunk/rdb/src/test/resources/asciifile.txt | 1 + .../resources/basicCompanyDepartmentMapping.xml | 39 + .../rdb/src/test/resources/basicCompanyMapping.xml | 25 + .../src/test/resources/basicCustomerMapping.xml | 29 + .../test/resources/basicCustomerMappingWithCUD.xml | 44 + .../resources/basicCustomerMappingWithCUD2.xml | 46 + .../basicCustomerMappingWithInvalidCUD.xml | 48 + .../test/resources/basicCustomerOrderMapping.xml | 35 + .../rdb/src/test/resources/basicStaticCustomer.xml | 28 + .../trunk/rdb/src/test/resources/cityStates.xml | 40 + das-java/trunk/rdb/src/test/resources/company.xsd | 52 + .../rdb/src/test/resources/companyMapping.xml | 42 + .../resources/companyMappingWithConverters.xml | 51 + .../companyMappingWithResultDescriptor.xml | 57 + .../trunk/rdb/src/test/resources/companynoid.xsd | 49 + .../resources/companynoidMappingWithConverters.xml | 44 + .../resources/connectionInfoDriverManagerAuth.xml | 33 + .../connectionInfoDriverManagerNoAuth.xml | 31 + das-java/trunk/rdb/src/test/resources/customer.xsd | 43 + .../rdb/src/test/resources/customerMapping.xml | 28 + .../customerMappingWithResultDescriptor.xml | 31 + .../resources/customerOrderRelationshipMapping.xml | 34 + das-java/trunk/rdb/src/test/resources/moin-www.png | Bin 0 -> 150 bytes .../rdb/src/test/resources/namedParameter.xml | 73 + .../rdb/src/test/resources/passiveConnection.xml | 26 + .../rdb/src/test/resources/staticCustomer.xml | 23 + .../rdb/src/test/resources/staticCustomerOrder.xml | 36 + .../trunk/rdb/src/test/resources/staticInvalid.xml | 23 + .../rdb/src/test/resources/storedProcTest.xml | 27 + das-java/trunk/samples/Readme.htm | 110 + das-java/trunk/samples/advanced-webapp/build.xml | 52 + das-java/trunk/samples/advanced-webapp/pom.xml | 108 + das-java/trunk/samples/advanced-webapp/readme.htm | 204 + .../tuscany/samples/das/DASQueryProcessor.java | 464 ++ .../samples/das/SillyDateStringConverter.java | 75 + .../tuscany/samples/das/StringToLongConverter.java | 37 + .../apache/tuscany/samples/das/util/XmlUtil.java | 58 + .../apache/tuscany/samples/web/CommandServlet.java | 160 + .../tuscany/samples/web/ServiceProcessor.java | 24 + .../src/main/resources/AjaxDBConfig.xml | 52 + .../main/resources/CustomerConfigWithConverter.xml | 34 + .../resources/CustomerConfigWithIDConverter.xml | 33 + .../src/main/resources/DasConfig.xml | 45 + .../src/main/resources/META-INF/LICENSE | 353 ++ .../src/main/resources/META-INF/NOTICE | 32 + .../src/main/resources/META-INF/README | 35 + .../src/main/resources/log4j.properties | 36 + .../src/main/webapp/META-INF/context.xml | 22 + .../src/main/webapp/WEB-INF/tld/c.tld | 563 +++ .../src/main/webapp/WEB-INF/tld/fmt.tld | 671 +++ .../src/main/webapp/WEB-INF/web.xml | 46 + .../src/main/webapp/html/DASWebSampleFrame.html | 27 + .../src/main/webapp/html/blank.html | 25 + .../advanced-webapp/src/main/webapp/js/ajax.js | 188 + .../advanced-webapp/src/main/webapp/js/dasmenu.js | 112 + .../src/main/webapp/jsp/DASMenu.jsp | 63 + .../src/main/webapp/jsp/converter.jsp | 117 + .../src/main/webapp/jsp/default.css | 35 + .../src/main/webapp/jsp/indexAdhoc.jsp | 87 + .../src/main/webapp/jsp/indexCommand.jsp | 85 + .../advanced-webapp/src/main/webapp/jsp/main.css | 120 + .../advanced-webapp/src/main/webapp/jsp/occ.jsp | 77 + .../advanced-webapp/src/main/webapp/jsp/rss.jsp | 78 + .../src/main/webapp/xsl/company.xsl | 44 + .../src/main/webapp/xsl/companyDepartment.xsl | 65 + .../src/main/webapp/xsl/customer.xsl | 49 + das-java/trunk/samples/build.xml | 29 + das-java/trunk/samples/company-webapp/build.xml | 55 + .../trunk/samples/company-webapp/dastest/db.lck | Bin 0 -> 38 bytes .../samples/company-webapp/dastest/log/log.ctrl | Bin 0 -> 48 bytes .../samples/company-webapp/dastest/log/log1.dat | Bin 0 -> 1048576 bytes .../company-webapp/dastest/log/logmirror.ctrl | Bin 0 -> 48 bytes .../samples/company-webapp/dastest/seg0/c10.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c101.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c111.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c121.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c130.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c141.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c150.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c161.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c171.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c180.dat | Bin 0 -> 24576 bytes .../samples/company-webapp/dastest/seg0/c191.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c1a1.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c1b1.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c1c0.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c1d1.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c1e0.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c1f1.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c20.dat | Bin 0 -> 24576 bytes .../samples/company-webapp/dastest/seg0/c200.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c211.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c221.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c230.dat | Bin 0 -> 86016 bytes .../samples/company-webapp/dastest/seg0/c241.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c251.dat | Bin 0 -> 12288 bytes .../samples/company-webapp/dastest/seg0/c260.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c271.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c281.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c290.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c2a1.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c2b1.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c2c1.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c2d0.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c2e1.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c2f0.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c300.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c31.dat | Bin 0 -> 16384 bytes .../samples/company-webapp/dastest/seg0/c311.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c320.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c331.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c340.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c351.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c360.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c371.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c380.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c391.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c3a0.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c3b1.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c3c0.dat | Bin 0 -> 24576 bytes .../samples/company-webapp/dastest/seg0/c3d1.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c3e0.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c3f1.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c400.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c41.dat | Bin 0 -> 16384 bytes .../samples/company-webapp/dastest/seg0/c411.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c420.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c431.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c440.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c451.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c460.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c471.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c481.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c490.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c4a1.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c51.dat | Bin 0 -> 16384 bytes .../samples/company-webapp/dastest/seg0/c60.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c71.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c81.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/c90.dat | Bin 0 -> 20480 bytes .../samples/company-webapp/dastest/seg0/ca1.dat | Bin 0 -> 24576 bytes .../samples/company-webapp/dastest/seg0/cb1.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/cc0.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/cd1.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/ce1.dat | Bin 0 -> 8192 bytes .../samples/company-webapp/dastest/seg0/cf0.dat | Bin 0 -> 8192 bytes .../company-webapp/dastest/service.properties | 22 + das-java/trunk/samples/company-webapp/pom.xml | 89 + das-java/trunk/samples/company-webapp/readme.htm | 201 + .../samples/das/companyweb/CompanyClient.java | 151 + .../samples/das/companyweb/CompanyDBInit.java | 70 + .../src/main/resources/CompanyConfig.xml | 46 + .../src/main/resources/CompanyWebDBConfig.xml | 51 + .../src/main/resources/META-INF/LICENSE | 353 ++ .../src/main/resources/META-INF/NOTICE | 32 + .../src/main/resources/META-INF/README | 35 + .../src/main/resources/log4j.properties | 36 + .../company-webapp/src/main/webapp/Company.jsp | 155 + .../src/main/webapp/META-INF/context.xml | 25 + .../company-webapp/src/main/webapp/WEB-INF/web.xml | 36 + das-java/trunk/samples/customer/build.xml | 38 + das-java/trunk/samples/customer/pom.xml | 92 + das-java/trunk/samples/customer/readme.htm | 156 + .../samples/das/customer/CustomerClient.java | 197 + .../das/customer/CustomerDatabaseInitializer.java | 92 + .../samples/das/databaseSetup/DatabaseSetup.java | 206 + .../samples/das/databaseSetup/DerbySetup.java | 209 + .../samples/das/databaseSetup/MySQLSetup.java | 211 + .../src/main/resources/CustomersConfig.xml | 53 + .../customer/src/main/resources/META-INF/LICENSE | 353 ++ .../customer/src/main/resources/META-INF/NOTICE | 32 + .../customer/src/main/resources/META-INF/README | 35 + .../customer/src/main/resources/log4j.properties | 36 + das-java/trunk/samples/dbconfig/pom.xml | 123 + das-java/trunk/samples/dbconfig/readme.html | 153 + .../tuscany/das/rdb/dbconfig/DBConfigUtil.java | 57 + .../das/rdb/dbconfig/DBConnectionHelper.java | 179 + .../tuscany/das/rdb/dbconfig/DBDataHelper.java | 251 ++ .../apache/tuscany/das/rdb/dbconfig/DBHelper.java | 200 + .../tuscany/das/rdb/dbconfig/DBInitializer.java | 154 + .../DataSourceInitializationException.java | 40 + .../rdb/dbconfig/DatabaseInitializerException.java | 40 + .../src/main/resources/CannedSampleDBConfig.xml | 47 + .../dbconfig/src/main/resources/DBConfig.xsd | 56 + .../dbconfig/src/main/resources/META-INF/LICENSE | 353 ++ .../dbconfig/src/main/resources/META-INF/NOTICE | 32 + .../dbconfig/src/main/resources/META-INF/README | 35 + .../dbconfig/src/main/resources/log4j.properties | 33 + .../das/rdb/dbconfig/DBInitializerTestCase.java | 69 + .../dbconfig/src/test/resources/dbConfig.xml | 52 + das-java/trunk/samples/pom.xml | 40 + .../samples/testing/tomcat/advanced-webapp/pom.xml | 80 + .../src/main/resources/META-INF/LICENSE | 353 ++ .../src/main/resources/META-INF/NOTICE | 32 + .../src/main/resources/META-INF/README | 35 + .../apache/tuscany/test/das/AjaxDasTestCase.java | 596 +++ das-java/trunk/samples/testing/tomcat/build.xml | 309 ++ .../samples/testing/tomcat/company-webapp/pom.xml | 80 + .../src/main/resources/META-INF/LICENSE | 353 ++ .../src/main/resources/META-INF/NOTICE | 32 + .../src/main/resources/META-INF/README | 35 + .../org/apache/tuscany/test/das/DasTestCase.java | 249 ++ das-java/trunk/samples/testing/tomcat/context.xsl | 51 + .../trunk/samples/testing/tomcat/datasource.xsl | 66 + das-java/trunk/samples/testing/tomcat/pom.xml | 112 + das-java/trunk/samples/testing/tomcat/readme.htm | 86 + das-java/trunk/samples/testing/tomcat/server.xsl | 51 + das-java/trunk/samples/transaction/build.xml | 46 + das-java/trunk/samples/transaction/pom.xml | 148 + das-java/trunk/samples/transaction/readme.htm | 449 ++ .../das/databaseSetup/DatabaseSetupUtil.java | 67 + .../manager/GeronimoTransactionManagerService.java | 118 + .../tx/manager/GeronimoTransactionManagerUtil.java | 122 + .../samples/das/tx/sample/MoneyTransfer.java | 193 + .../src/main/resources/BankAccountDBConfig.xml | 34 + .../src/main/resources/BankAccounts.xml | 30 + das-java/trunk/tools/pom.xml | 147 + das-java/trunk/tools/readme.htm | 78 + .../org/apache/tuscany/das/rdb/util/Column.java | 57 + .../org/apache/tuscany/das/rdb/util/DBSchema.java | 45 + .../tuscany/das/rdb/util/DBToSchemaFile.java | 119 + .../tuscany/das/rdb/util/DBToXSDGenerator.java | 88 + .../apache/tuscany/das/rdb/util/ForeignKey.java | 51 + .../apache/tuscany/das/rdb/util/ForeignKeyRef.java | 44 + .../tuscany/das/rdb/util/ModelXSDGenOption.java | 133 + .../tuscany/das/rdb/util/SQLTypeChecker.java | 186 + .../tuscany/das/rdb/util/SchemaFileToXSD.java | 200 + .../org/apache/tuscany/das/rdb/util/Table.java | 66 + .../apache/tuscany/das/rdb/test/DBToXSDTests.java | 142 + .../src/test/resources/DBConnectionConfig.xml | 31 + .../trunk/tools/src/test/resources/dbConfig.xml | 34 + java/das/distribution/binary/DISCLAIMER | 7 - java/das/distribution/binary/LICENSE | 353 -- java/das/distribution/binary/NOTICE | 24 - java/das/distribution/binary/README | 10 - java/das/distribution/binary/RELEASE_NOTES | 33 - java/das/distribution/binary/pom.xml | 98 - .../distribution/binary/src/main/assembly/das.xml | 174 - java/das/distribution/source/BUILDING | 47 - java/das/distribution/source/DISCLAIMER | 7 - java/das/distribution/source/LICENSE | 353 -- java/das/distribution/source/NOTICE | 24 - java/das/distribution/source/README | 10 - java/das/distribution/source/RELEASE_NOTES | 33 - java/das/distribution/source/pom.xml | 66 - .../distribution/source/src/main/assembly/src.xml | 63 - java/das/plugin/pom.xml | 107 - .../apache/tuscany/das/plugin/GeneratorMojo.java | 111 - java/das/pom.xml | 160 - java/das/rdb/pom.xml | 272 -- .../java/org/apache/tuscany/das/rdb/Command.java | 138 - .../org/apache/tuscany/das/rdb/ConfigHelper.java | 318 -- .../java/org/apache/tuscany/das/rdb/Converter.java | 54 - .../main/java/org/apache/tuscany/das/rdb/DAS.java | 67 - .../org/apache/tuscany/das/rdb/DASFactory.java | 74 - .../java/org/apache/tuscany/das/rdb/Pager.java | 64 - .../das/rdb/config/wrapper/MappingWrapper.java | 945 ---- .../das/rdb/config/wrapper/QualifiedColumn.java | 94 - .../rdb/config/wrapper/RelationshipWrapper.java | 50 - .../das/rdb/config/wrapper/TableWrapper.java | 149 - .../DataSourceInitializationException.java | 36 - .../exception/OptimisticConcurrencyException.java | 31 - .../das/rdb/generator/impl/BaseGenerator.java | 36 - .../das/rdb/generator/impl/DeleteGenerator.java | 91 - .../das/rdb/generator/impl/InsertGenerator.java | 182 - .../das/rdb/generator/impl/UpdateGenerator.java | 271 -- .../das/rdb/graphbuilder/impl/DataObjectMaker.java | 123 - .../rdb/graphbuilder/impl/DefaultConverter.java | 84 - .../graphbuilder/impl/GraphBuilderMetadata.java | 283 -- .../rdb/graphbuilder/impl/MultiTableRegistry.java | 116 - .../das/rdb/graphbuilder/impl/ResultMetadata.java | 411 -- .../rdb/graphbuilder/impl/ResultSetProcessor.java | 180 - .../das/rdb/graphbuilder/impl/ResultSetRow.java | 390 -- .../das/rdb/graphbuilder/impl/RowObjects.java | 205 - .../rdb/graphbuilder/impl/SingleTableRegistry.java | 49 - .../das/rdb/graphbuilder/impl/TableData.java | 123 - .../das/rdb/graphbuilder/impl/TableRegistry.java | 47 - .../rdb/graphbuilder/schema/ResultSetTypeMap.java | 137 - .../das/rdb/impl/ApplyChangesCommandImpl.java | 79 - .../tuscany/das/rdb/impl/BaseCommandImpl.java | 62 - .../apache/tuscany/das/rdb/impl/ChangeFactory.java | 189 - .../tuscany/das/rdb/impl/ChangeOperation.java | 87 - .../tuscany/das/rdb/impl/ChangeSummarizer.java | 268 -- .../org/apache/tuscany/das/rdb/impl/Changes.java | 82 - .../tuscany/das/rdb/impl/CollisionParameter.java | 31 - .../apache/tuscany/das/rdb/impl/CommandImpl.java | 160 - .../tuscany/das/rdb/impl/ConnectionImpl.java | 154 - .../tuscany/das/rdb/impl/CreateOperation.java | 30 - .../tuscany/das/rdb/impl/DASFactoryImpl.java | 50 - .../org/apache/tuscany/das/rdb/impl/DASImpl.java | 327 -- .../tuscany/das/rdb/impl/DatabaseObject.java | 229 - .../tuscany/das/rdb/impl/DeleteCommandImpl.java | 37 - .../apache/tuscany/das/rdb/impl/DeleteList.java | 77 - .../tuscany/das/rdb/impl/DeleteOperation.java | 38 - .../tuscany/das/rdb/impl/FactoryRegistry.java | 57 - .../tuscany/das/rdb/impl/InsertCommandImpl.java | 75 - .../apache/tuscany/das/rdb/impl/InsertList.java | 95 - .../tuscany/das/rdb/impl/ManagedParameterImpl.java | 39 - .../das/rdb/impl/OptimisticWriteCommandImpl.java | 48 - .../org/apache/tuscany/das/rdb/impl/PagerImpl.java | 69 - .../das/rdb/impl/ParameterExtendedImpl.java | 99 - .../apache/tuscany/das/rdb/impl/ParameterImpl.java | 120 - .../apache/tuscany/das/rdb/impl/Parameters.java | 113 - .../das/rdb/impl/ParametersExtendedImpl.java | 189 - .../tuscany/das/rdb/impl/ReadCommandImpl.java | 338 -- .../tuscany/das/rdb/impl/ResultSetShape.java | 161 - .../tuscany/das/rdb/impl/SDODataTypeHelper.java | 189 - .../apache/tuscany/das/rdb/impl/SDODataTypes.java | 130 - .../apache/tuscany/das/rdb/impl/SPCommandImpl.java | 100 - .../org/apache/tuscany/das/rdb/impl/Statement.java | 233 - .../tuscany/das/rdb/impl/UpdateCommandImpl.java | 37 - .../apache/tuscany/das/rdb/impl/UpdateList.java | 45 - .../tuscany/das/rdb/impl/UpdateOperation.java | 32 - .../tuscany/das/rdb/impl/WriteCommandImpl.java | 165 - .../tuscany/das/rdb/merge/impl/GraphMerger.java | 391 -- .../tuscany/das/rdb/util/CollectionsUtil.java | 49 - .../apache/tuscany/das/rdb/util/ConfigUtil.java | 130 - .../tuscany/das/rdb/util/DataObjectUtil.java | 79 - .../das/rdb/src/main/resources/META-INF/DISCLAIMER | 7 - java/das/rdb/src/main/resources/META-INF/LICENSE | 353 -- java/das/rdb/src/main/resources/META-INF/NOTICE | 32 - java/das/rdb/src/main/resources/META-INF/README | 35 - java/das/rdb/src/main/resources/config.xsd | 152 - java/das/rdb/src/main/resources/dasmodel4.mdl | 4622 -------------------- .../apache/tuscany/das/rdb/test/AliasTests.java | 186 - .../tuscany/das/rdb/test/BestPracticeTests.java | 153 - .../apache/tuscany/das/rdb/test/CUDGeneration.java | 111 - .../das/rdb/test/CheckSupportGeneratedKeys.java | 167 - .../tuscany/das/rdb/test/CommandGroupTests.java | 161 - .../apache/tuscany/das/rdb/test/CompanyTests.java | 171 - .../das/rdb/test/CompoundKeyRelationshipTests.java | 265 -- .../tuscany/das/rdb/test/CompoundKeyTests.java | 109 - .../tuscany/das/rdb/test/ConnectionTests.java | 89 - .../tuscany/das/rdb/test/ConverterTests.java | 222 - .../tuscany/das/rdb/test/CorrectedDefectTests.java | 304 -- .../das/rdb/test/CrudWithChangeHistory.java | 405 -- .../apache/tuscany/das/rdb/test/DefectTests.java | 115 - .../das/rdb/test/DynamicResultDescriptorTests.java | 351 -- .../tuscany/das/rdb/test/ExceptionTests.java | 153 - .../das/rdb/test/GeneratedCommandTests.java | 94 - .../apache/tuscany/das/rdb/test/GeneratedId.java | 313 -- .../tuscany/das/rdb/test/GraphMergeTests.java | 625 --- .../das/rdb/test/ImpliedRelationshipTests.java | 112 - .../apache/tuscany/das/rdb/test/KennelTests.java | 123 - .../org/apache/tuscany/das/rdb/test/LOBTests.java | 96 - .../tuscany/das/rdb/test/MissingPKTests.java | 350 -- .../tuscany/das/rdb/test/MultiSchemaTests.java | 715 --- .../tuscany/das/rdb/test/NamedParameterTests.java | 241 - .../org/apache/tuscany/das/rdb/test/OCCTests.java | 163 - .../das/rdb/test/OneToOneRelationshipTests.java | 174 - .../das/rdb/test/OperationOrderingTests.java | 124 - .../org/apache/tuscany/das/rdb/test/Paging.java | 134 - .../tuscany/das/rdb/test/PartialUpdateTests.java | 267 -- .../das/rdb/test/PassiveConnectionTests.java | 148 - .../das/rdb/test/ProgrammaticConfigTests.java | 432 -- .../tuscany/das/rdb/test/ReadDBSchemaTests.java | 55 - .../tuscany/das/rdb/test/RecursiveTests.java | 71 - .../tuscany/das/rdb/test/RelationshipTests.java | 729 --- .../tuscany/das/rdb/test/ResultSetShapeTests.java | 91 - .../tuscany/das/rdb/test/SerializationTests.java | 76 - .../apache/tuscany/das/rdb/test/SimplestCrud.java | 228 - .../apache/tuscany/das/rdb/test/StoredProcs.java | 142 - .../org/apache/tuscany/das/rdb/test/TopDown.java | 75 - .../tuscany/das/rdb/test/TransactionTests.java | 87 - .../org/apache/tuscany/das/rdb/test/TypeTests.java | 108 - .../commands/ReadCustomersByLastnameCommand.java | 56 - .../rdb/test/commands/ReadCustomersCommand.java | 57 - .../commands/ReadCustomersStaticTypesCommand.java | 66 - .../commands/ReadCustomersWithShapeCommand.java | 63 - .../SimpleReadCustomersWithShapeCommand.java | 83 - .../apache/tuscany/das/rdb/test/data/BookData.java | 46 - .../apache/tuscany/das/rdb/test/data/CityData.java | 54 - .../tuscany/das/rdb/test/data/CompanyData.java | 44 - .../tuscany/das/rdb/test/data/CompanyDeptData.java | 41 - .../tuscany/das/rdb/test/data/CompanyEmpData.java | 45 - .../tuscany/das/rdb/test/data/CustomerData.java | 39 - .../tuscany/das/rdb/test/data/DepEmpData.java | 43 - .../tuscany/das/rdb/test/data/DepartmentData.java | 44 - .../das/rdb/test/data/DocumentsImagesData.java | 82 - .../apache/tuscany/das/rdb/test/data/DogData.java | 54 - .../tuscany/das/rdb/test/data/EmployeeData.java | 46 - .../tuscany/das/rdb/test/data/KennelData.java | 53 - .../tuscany/das/rdb/test/data/MultiSchemaData.java | 99 - .../tuscany/das/rdb/test/data/OrderData.java | 41 - .../das/rdb/test/data/OrderDetailsData.java | 43 - .../rdb/test/data/OrderDetailsDescriptionData.java | 47 - .../tuscany/das/rdb/test/data/OwnerData.java | 53 - .../tuscany/das/rdb/test/data/OwnerDogData.java | 41 - .../apache/tuscany/das/rdb/test/data/PartData.java | 48 - .../tuscany/das/rdb/test/data/ProductData.java | 41 - .../das/rdb/test/data/ProductProdSpecData.java | 44 - .../tuscany/das/rdb/test/data/ProductSpecData.java | 41 - .../tuscany/das/rdb/test/data/SingerData.java | 44 - .../apache/tuscany/das/rdb/test/data/SongData.java | 45 - .../tuscany/das/rdb/test/data/StateData.java | 48 - .../tuscany/das/rdb/test/data/TypesData.java | 38 - .../tuscany/das/rdb/test/data/VisitData.java | 52 - .../tuscany/das/rdb/test/framework/DB2Setup.java | 37 - .../tuscany/das/rdb/test/framework/DasTest.java | 147 - .../das/rdb/test/framework/DatabaseSetup.java | 572 --- .../tuscany/das/rdb/test/framework/DerbySetup.java | 44 - .../das/rdb/test/framework/JavaStoredProcs.java | 97 - .../tuscany/das/rdb/test/framework/MySQLSetup.java | 105 - .../das/rdb/test/framework/RelationshipData.java | 80 - .../tuscany/das/rdb/test/framework/TestData.java | 126 - .../framework/TestDataWithExplicitColumns.java | 87 - .../test/mappings/IntegerToBooleanConverter.java | 43 - .../test/mappings/SillyDateStringConverter.java | 77 - .../test/mappings/StringObfuscationConverter.java | 65 - .../test/mappings/StringToIntegerConverter.java | 39 - .../rdb/test/mappings/StringToLongConverter.java | 37 - .../das/rdb/test/suites/AllCommonTests.java | 127 - .../tuscany/das/rdb/test/suites/AllTestsDB2.java | 44 - .../tuscany/das/rdb/test/suites/AllTestsDerby.java | 35 - .../tuscany/das/rdb/test/suites/AllTestsMySQL.java | 39 - .../das/rdb/test/typed/SimplestStaticCrud.java | 58 - .../rdb/test/util/PrintPropertiesOfDataObject.java | 134 - .../rdb/src/test/resources/1xM_mapping_no_cud.xml | 36 - java/das/rdb/src/test/resources/BooksConfig.xml | 30 - .../src/test/resources/BooksConfigWithAlias.xml | 36 - java/das/rdb/src/test/resources/CompanyConfig.xml | 43 - .../src/test/resources/CompanyEmployeeConfig.xml | 54 - java/das/rdb/src/test/resources/CustomerConfig.xml | 24 - .../test/resources/CustomerConfigWithConverter.xml | 33 - .../resources/CustomerConfigWithConverter2.xml | 29 - .../resources/CustomerConfigWithIDConverter.xml | 32 - .../src/test/resources/CustomersOrdersConfig.xml | 51 - .../test/resources/CustomersOrdersConfigProps.xml | 53 - .../test/resources/CustomersOrdersRelationship.xml | 53 - java/das/rdb/src/test/resources/InvalidConfig1.xml | 32 - .../rdb/src/test/resources/InvalidConverter.xml | 36 - .../rdb/src/test/resources/ManagedBooksConfig.xml | 30 - java/das/rdb/src/test/resources/MissingPK.xml | 59 - java/das/rdb/src/test/resources/MissingPKREL.xml | 63 - .../src/test/resources/MultiSchemaDasConfig1.xml | 36 - .../src/test/resources/MultiSchemaDasConfig12.xml | 33 - .../src/test/resources/MultiSchemaDasConfig13.xml | 34 - .../src/test/resources/MultiSchemaDasConfig14.xml | 37 - .../src/test/resources/MultiSchemaDasConfig2.xml | 45 - .../src/test/resources/MultiSchemaDasConfig3.xml | 32 - .../src/test/resources/MultiSchemaDasConfig5.xml | 32 - .../src/test/resources/MultiSchemaDasConfig6.xml | 38 - .../src/test/resources/MultiSchemaDasConfig7.xml | 26 - .../src/test/resources/MultiSchemaDasConfig8.xml | 34 - .../src/test/resources/MultiSchemaDasConfig9.xml | 30 - .../test/resources/MultiSchemaInvalidDasConfig.xml | 47 - .../test/resources/OneToOneNonRestrictedConfig.xml | 51 - .../test/resources/OneToOneRestrictedConfig.xml | 69 - .../test/resources/OrderDetailsAndDescription.xml | 35 - .../test/resources/OrdersOrderDetailsConfig.xml | 36 - java/das/rdb/src/test/resources/PartsConfig.xml | 50 - java/das/rdb/src/test/resources/SINGER.xsd | 39 - java/das/rdb/src/test/resources/asciifile.txt | 1 - .../resources/basicCompanyDepartmentMapping.xml | 39 - .../rdb/src/test/resources/basicCompanyMapping.xml | 25 - .../src/test/resources/basicCustomerMapping.xml | 29 - .../test/resources/basicCustomerMappingWithCUD.xml | 44 - .../resources/basicCustomerMappingWithCUD2.xml | 46 - .../basicCustomerMappingWithInvalidCUD.xml | 48 - .../test/resources/basicCustomerOrderMapping.xml | 35 - .../rdb/src/test/resources/basicStaticCustomer.xml | 28 - java/das/rdb/src/test/resources/cityStates.xml | 40 - java/das/rdb/src/test/resources/company.xsd | 52 - java/das/rdb/src/test/resources/companyMapping.xml | 42 - .../resources/companyMappingWithConverters.xml | 51 - .../companyMappingWithResultDescriptor.xml | 57 - java/das/rdb/src/test/resources/companynoid.xsd | 49 - .../resources/companynoidMappingWithConverters.xml | 44 - .../resources/connectionInfoDriverManagerAuth.xml | 33 - .../connectionInfoDriverManagerNoAuth.xml | 31 - java/das/rdb/src/test/resources/customer.xsd | 43 - .../das/rdb/src/test/resources/customerMapping.xml | 28 - .../customerMappingWithResultDescriptor.xml | 31 - .../resources/customerOrderRelationshipMapping.xml | 34 - java/das/rdb/src/test/resources/moin-www.png | Bin 150 -> 0 bytes java/das/rdb/src/test/resources/namedParameter.xml | 73 - .../rdb/src/test/resources/passiveConnection.xml | 26 - java/das/rdb/src/test/resources/staticCustomer.xml | 23 - .../rdb/src/test/resources/staticCustomerOrder.xml | 36 - java/das/rdb/src/test/resources/staticInvalid.xml | 23 - java/das/rdb/src/test/resources/storedProcTest.xml | 27 - java/das/samples/Readme.htm | 110 - java/das/samples/advanced-webapp/build.xml | 52 - java/das/samples/advanced-webapp/pom.xml | 108 - java/das/samples/advanced-webapp/readme.htm | 204 - .../tuscany/samples/das/DASQueryProcessor.java | 464 -- .../samples/das/SillyDateStringConverter.java | 75 - .../tuscany/samples/das/StringToLongConverter.java | 37 - .../apache/tuscany/samples/das/util/XmlUtil.java | 58 - .../apache/tuscany/samples/web/CommandServlet.java | 160 - .../tuscany/samples/web/ServiceProcessor.java | 24 - .../src/main/resources/AjaxDBConfig.xml | 52 - .../main/resources/CustomerConfigWithConverter.xml | 34 - .../resources/CustomerConfigWithIDConverter.xml | 33 - .../src/main/resources/DasConfig.xml | 45 - .../src/main/resources/META-INF/LICENSE | 353 -- .../src/main/resources/META-INF/NOTICE | 32 - .../src/main/resources/META-INF/README | 35 - .../src/main/resources/log4j.properties | 36 - .../src/main/webapp/META-INF/context.xml | 22 - .../src/main/webapp/WEB-INF/tld/c.tld | 563 --- .../src/main/webapp/WEB-INF/tld/fmt.tld | 671 --- .../src/main/webapp/WEB-INF/web.xml | 46 - .../src/main/webapp/html/DASWebSampleFrame.html | 27 - .../src/main/webapp/html/blank.html | 25 - .../advanced-webapp/src/main/webapp/js/ajax.js | 188 - .../advanced-webapp/src/main/webapp/js/dasmenu.js | 112 - .../src/main/webapp/jsp/DASMenu.jsp | 63 - .../src/main/webapp/jsp/converter.jsp | 117 - .../src/main/webapp/jsp/default.css | 35 - .../src/main/webapp/jsp/indexAdhoc.jsp | 87 - .../src/main/webapp/jsp/indexCommand.jsp | 85 - .../advanced-webapp/src/main/webapp/jsp/main.css | 120 - .../advanced-webapp/src/main/webapp/jsp/occ.jsp | 77 - .../advanced-webapp/src/main/webapp/jsp/rss.jsp | 78 - .../src/main/webapp/xsl/company.xsl | 44 - .../src/main/webapp/xsl/companyDepartment.xsl | 65 - .../src/main/webapp/xsl/customer.xsl | 49 - java/das/samples/build.xml | 29 - java/das/samples/company-webapp/build.xml | 55 - java/das/samples/company-webapp/dastest/db.lck | Bin 38 -> 0 bytes .../samples/company-webapp/dastest/log/log.ctrl | Bin 48 -> 0 bytes .../samples/company-webapp/dastest/log/log1.dat | Bin 1048576 -> 0 bytes .../company-webapp/dastest/log/logmirror.ctrl | Bin 48 -> 0 bytes .../samples/company-webapp/dastest/seg0/c10.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c101.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c111.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c121.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c130.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c141.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c150.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c161.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c171.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c180.dat | Bin 24576 -> 0 bytes .../samples/company-webapp/dastest/seg0/c191.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c1a1.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c1b1.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c1c0.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c1d1.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c1e0.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c1f1.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c20.dat | Bin 24576 -> 0 bytes .../samples/company-webapp/dastest/seg0/c200.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c211.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c221.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c230.dat | Bin 86016 -> 0 bytes .../samples/company-webapp/dastest/seg0/c241.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c251.dat | Bin 12288 -> 0 bytes .../samples/company-webapp/dastest/seg0/c260.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c271.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c281.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c290.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c2a1.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c2b1.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c2c1.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c2d0.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c2e1.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c2f0.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c300.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c31.dat | Bin 16384 -> 0 bytes .../samples/company-webapp/dastest/seg0/c311.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c320.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c331.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c340.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c351.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c360.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c371.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c380.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c391.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c3a0.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c3b1.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c3c0.dat | Bin 24576 -> 0 bytes .../samples/company-webapp/dastest/seg0/c3d1.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c3e0.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c3f1.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c400.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c41.dat | Bin 16384 -> 0 bytes .../samples/company-webapp/dastest/seg0/c411.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c420.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c431.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c440.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c451.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c460.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c471.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c481.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c490.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c4a1.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c51.dat | Bin 16384 -> 0 bytes .../samples/company-webapp/dastest/seg0/c60.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c71.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c81.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/c90.dat | Bin 20480 -> 0 bytes .../samples/company-webapp/dastest/seg0/ca1.dat | Bin 24576 -> 0 bytes .../samples/company-webapp/dastest/seg0/cb1.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/cc0.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/cd1.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/ce1.dat | Bin 8192 -> 0 bytes .../samples/company-webapp/dastest/seg0/cf0.dat | Bin 8192 -> 0 bytes .../company-webapp/dastest/service.properties | 22 - java/das/samples/company-webapp/pom.xml | 89 - java/das/samples/company-webapp/readme.htm | 201 - .../samples/das/companyweb/CompanyClient.java | 151 - .../samples/das/companyweb/CompanyDBInit.java | 70 - .../src/main/resources/CompanyConfig.xml | 46 - .../src/main/resources/CompanyWebDBConfig.xml | 51 - .../src/main/resources/META-INF/LICENSE | 353 -- .../src/main/resources/META-INF/NOTICE | 32 - .../src/main/resources/META-INF/README | 35 - .../src/main/resources/log4j.properties | 36 - .../company-webapp/src/main/webapp/Company.jsp | 155 - .../src/main/webapp/META-INF/context.xml | 25 - .../company-webapp/src/main/webapp/WEB-INF/web.xml | 36 - java/das/samples/customer/build.xml | 38 - java/das/samples/customer/pom.xml | 92 - java/das/samples/customer/readme.htm | 156 - .../samples/das/customer/CustomerClient.java | 197 - .../das/customer/CustomerDatabaseInitializer.java | 92 - .../samples/das/databaseSetup/DatabaseSetup.java | 206 - .../samples/das/databaseSetup/DerbySetup.java | 209 - .../samples/das/databaseSetup/MySQLSetup.java | 211 - .../src/main/resources/CustomersConfig.xml | 53 - .../customer/src/main/resources/META-INF/LICENSE | 353 -- .../customer/src/main/resources/META-INF/NOTICE | 32 - .../customer/src/main/resources/META-INF/README | 35 - .../customer/src/main/resources/log4j.properties | 36 - java/das/samples/dbconfig/pom.xml | 123 - java/das/samples/dbconfig/readme.html | 153 - .../tuscany/das/rdb/dbconfig/DBConfigUtil.java | 57 - .../das/rdb/dbconfig/DBConnectionHelper.java | 179 - .../tuscany/das/rdb/dbconfig/DBDataHelper.java | 251 -- .../apache/tuscany/das/rdb/dbconfig/DBHelper.java | 200 - .../tuscany/das/rdb/dbconfig/DBInitializer.java | 154 - .../DataSourceInitializationException.java | 40 - .../rdb/dbconfig/DatabaseInitializerException.java | 40 - .../src/main/resources/CannedSampleDBConfig.xml | 47 - .../dbconfig/src/main/resources/DBConfig.xsd | 56 - .../dbconfig/src/main/resources/META-INF/LICENSE | 353 -- .../dbconfig/src/main/resources/META-INF/NOTICE | 32 - .../dbconfig/src/main/resources/META-INF/README | 35 - .../dbconfig/src/main/resources/log4j.properties | 33 - .../das/rdb/dbconfig/DBInitializerTestCase.java | 69 - .../dbconfig/src/test/resources/dbConfig.xml | 52 - java/das/samples/pom.xml | 40 - .../samples/testing/tomcat/advanced-webapp/pom.xml | 80 - .../src/main/resources/META-INF/LICENSE | 353 -- .../src/main/resources/META-INF/NOTICE | 32 - .../src/main/resources/META-INF/README | 35 - .../apache/tuscany/test/das/AjaxDasTestCase.java | 596 --- java/das/samples/testing/tomcat/build.xml | 309 -- .../samples/testing/tomcat/company-webapp/pom.xml | 80 - .../src/main/resources/META-INF/LICENSE | 353 -- .../src/main/resources/META-INF/NOTICE | 32 - .../src/main/resources/META-INF/README | 35 - .../org/apache/tuscany/test/das/DasTestCase.java | 249 -- java/das/samples/testing/tomcat/context.xsl | 51 - java/das/samples/testing/tomcat/datasource.xsl | 66 - java/das/samples/testing/tomcat/pom.xml | 112 - java/das/samples/testing/tomcat/readme.htm | 86 - java/das/samples/testing/tomcat/server.xsl | 51 - java/das/samples/transaction/build.xml | 46 - java/das/samples/transaction/pom.xml | 148 - java/das/samples/transaction/readme.htm | 449 -- .../das/databaseSetup/DatabaseSetupUtil.java | 67 - .../manager/GeronimoTransactionManagerService.java | 118 - .../tx/manager/GeronimoTransactionManagerUtil.java | 122 - .../samples/das/tx/sample/MoneyTransfer.java | 193 - .../src/main/resources/BankAccountDBConfig.xml | 34 - .../src/main/resources/BankAccounts.xml | 30 - java/das/tools/pom.xml | 147 - java/das/tools/readme.htm | 78 - .../org/apache/tuscany/das/rdb/util/Column.java | 57 - .../org/apache/tuscany/das/rdb/util/DBSchema.java | 45 - .../tuscany/das/rdb/util/DBToSchemaFile.java | 119 - .../tuscany/das/rdb/util/DBToXSDGenerator.java | 88 - .../apache/tuscany/das/rdb/util/ForeignKey.java | 51 - .../apache/tuscany/das/rdb/util/ForeignKeyRef.java | 44 - .../tuscany/das/rdb/util/ModelXSDGenOption.java | 133 - .../tuscany/das/rdb/util/SQLTypeChecker.java | 186 - .../tuscany/das/rdb/util/SchemaFileToXSD.java | 200 - .../org/apache/tuscany/das/rdb/util/Table.java | 66 - .../apache/tuscany/das/rdb/test/DBToXSDTests.java | 142 - .../src/test/resources/DBConnectionConfig.xml | 31 - java/das/tools/src/test/resources/dbConfig.xml | 34 - 904 files changed, 46133 insertions(+), 46133 deletions(-) create mode 100644 das-java/trunk/distribution/binary/DISCLAIMER create mode 100644 das-java/trunk/distribution/binary/LICENSE create mode 100644 das-java/trunk/distribution/binary/NOTICE create mode 100644 das-java/trunk/distribution/binary/README create mode 100644 das-java/trunk/distribution/binary/RELEASE_NOTES create mode 100644 das-java/trunk/distribution/binary/pom.xml create mode 100644 das-java/trunk/distribution/binary/src/main/assembly/das.xml create mode 100644 das-java/trunk/distribution/source/BUILDING create mode 100644 das-java/trunk/distribution/source/DISCLAIMER create mode 100644 das-java/trunk/distribution/source/LICENSE create mode 100644 das-java/trunk/distribution/source/NOTICE create mode 100644 das-java/trunk/distribution/source/README create mode 100644 das-java/trunk/distribution/source/RELEASE_NOTES create mode 100644 das-java/trunk/distribution/source/pom.xml create mode 100644 das-java/trunk/distribution/source/src/main/assembly/src.xml create mode 100644 das-java/trunk/plugin/pom.xml create mode 100644 das-java/trunk/plugin/src/main/java/org/apache/tuscany/das/plugin/GeneratorMojo.java create mode 100644 das-java/trunk/pom.xml create mode 100644 das-java/trunk/rdb/pom.xml create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/Command.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/ConfigHelper.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/Converter.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/DAS.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/DASFactory.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/Pager.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/MappingWrapper.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/QualifiedColumn.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/RelationshipWrapper.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/TableWrapper.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/exception/DataSourceInitializationException.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/exception/OptimisticConcurrencyException.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/BaseGenerator.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/DeleteGenerator.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/InsertGenerator.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/UpdateGenerator.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DefaultConverter.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/GraphBuilderMetadata.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/MultiTableRegistry.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetProcessor.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetRow.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/RowObjects.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/SingleTableRegistry.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableRegistry.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ResultSetTypeMap.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ApplyChangesCommandImpl.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/BaseCommandImpl.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeFactory.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeOperation.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeSummarizer.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Changes.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CollisionParameter.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandImpl.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CreateOperation.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASFactoryImpl.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASImpl.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DatabaseObject.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteCommandImpl.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteList.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteOperation.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/FactoryRegistry.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertCommandImpl.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertList.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ManagedParameterImpl.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/OptimisticWriteCommandImpl.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/PagerImpl.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterExtendedImpl.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterImpl.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Parameters.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParametersExtendedImpl.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ReadCommandImpl.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ResultSetShape.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypeHelper.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypes.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SPCommandImpl.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Statement.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateCommandImpl.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateList.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateOperation.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/WriteCommandImpl.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/merge/impl/GraphMerger.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/util/CollectionsUtil.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/util/ConfigUtil.java create mode 100644 das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DataObjectUtil.java create mode 100644 das-java/trunk/rdb/src/main/resources/META-INF/DISCLAIMER create mode 100644 das-java/trunk/rdb/src/main/resources/META-INF/LICENSE create mode 100644 das-java/trunk/rdb/src/main/resources/META-INF/NOTICE create mode 100644 das-java/trunk/rdb/src/main/resources/META-INF/README create mode 100644 das-java/trunk/rdb/src/main/resources/config.xsd create mode 100644 das-java/trunk/rdb/src/main/resources/dasmodel4.mdl create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/AliasTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/BestPracticeTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CUDGeneration.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CheckSupportGeneratedKeys.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyRelationshipTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConnectionTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DynamicResultDescriptorTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedCommandTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedId.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GraphMergeTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ImpliedRelationshipTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/KennelTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/LOBTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/MissingPKTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/MultiSchemaTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/NamedParameterTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OCCTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OneToOneRelationshipTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OperationOrderingTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/Paging.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PartialUpdateTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PassiveConnectionTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ProgrammaticConfigTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ReadDBSchemaTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RecursiveTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ResultSetShapeTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SerializationTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SimplestCrud.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/StoredProcs.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TopDown.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TransactionTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TypeTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersByLastnameCommand.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersCommand.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersWithShapeCommand.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/SimpleReadCustomersWithShapeCommand.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/BookData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CityData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyDeptData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyEmpData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CustomerData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepEmpData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DocumentsImagesData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DogData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/EmployeeData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/KennelData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/MultiSchemaData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsDescriptionData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OwnerData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OwnerDogData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/PartData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/ProductData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/ProductProdSpecData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/ProductSpecData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SingerData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SongData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/StateData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/TypesData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/VisitData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DB2Setup.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DasTest.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DatabaseSetup.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DerbySetup.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/JavaStoredProcs.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/MySQLSetup.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/RelationshipData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestData.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestDataWithExplicitColumns.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/IntegerToBooleanConverter.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/SillyDateStringConverter.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringObfuscationConverter.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToIntegerConverter.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToLongConverter.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllCommonTests.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDB2.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDerby.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsMySQL.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/typed/SimplestStaticCrud.java create mode 100644 das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/util/PrintPropertiesOfDataObject.java create mode 100644 das-java/trunk/rdb/src/test/resources/1xM_mapping_no_cud.xml create mode 100644 das-java/trunk/rdb/src/test/resources/BooksConfig.xml create mode 100644 das-java/trunk/rdb/src/test/resources/BooksConfigWithAlias.xml create mode 100644 das-java/trunk/rdb/src/test/resources/CompanyConfig.xml create mode 100644 das-java/trunk/rdb/src/test/resources/CompanyEmployeeConfig.xml create mode 100644 das-java/trunk/rdb/src/test/resources/CustomerConfig.xml create mode 100644 das-java/trunk/rdb/src/test/resources/CustomerConfigWithConverter.xml create mode 100644 das-java/trunk/rdb/src/test/resources/CustomerConfigWithConverter2.xml create mode 100644 das-java/trunk/rdb/src/test/resources/CustomerConfigWithIDConverter.xml create mode 100644 das-java/trunk/rdb/src/test/resources/CustomersOrdersConfig.xml create mode 100644 das-java/trunk/rdb/src/test/resources/CustomersOrdersConfigProps.xml create mode 100644 das-java/trunk/rdb/src/test/resources/CustomersOrdersRelationship.xml create mode 100644 das-java/trunk/rdb/src/test/resources/InvalidConfig1.xml create mode 100644 das-java/trunk/rdb/src/test/resources/InvalidConverter.xml create mode 100644 das-java/trunk/rdb/src/test/resources/ManagedBooksConfig.xml create mode 100644 das-java/trunk/rdb/src/test/resources/MissingPK.xml create mode 100644 das-java/trunk/rdb/src/test/resources/MissingPKREL.xml create mode 100644 das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig1.xml create mode 100644 das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig12.xml create mode 100644 das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig13.xml create mode 100644 das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig14.xml create mode 100644 das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig2.xml create mode 100644 das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig3.xml create mode 100644 das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig5.xml create mode 100644 das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig6.xml create mode 100644 das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig7.xml create mode 100644 das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig8.xml create mode 100644 das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig9.xml create mode 100644 das-java/trunk/rdb/src/test/resources/MultiSchemaInvalidDasConfig.xml create mode 100644 das-java/trunk/rdb/src/test/resources/OneToOneNonRestrictedConfig.xml create mode 100644 das-java/trunk/rdb/src/test/resources/OneToOneRestrictedConfig.xml create mode 100644 das-java/trunk/rdb/src/test/resources/OrderDetailsAndDescription.xml create mode 100644 das-java/trunk/rdb/src/test/resources/OrdersOrderDetailsConfig.xml create mode 100644 das-java/trunk/rdb/src/test/resources/PartsConfig.xml create mode 100644 das-java/trunk/rdb/src/test/resources/SINGER.xsd create mode 100644 das-java/trunk/rdb/src/test/resources/asciifile.txt create mode 100644 das-java/trunk/rdb/src/test/resources/basicCompanyDepartmentMapping.xml create mode 100644 das-java/trunk/rdb/src/test/resources/basicCompanyMapping.xml create mode 100644 das-java/trunk/rdb/src/test/resources/basicCustomerMapping.xml create mode 100644 das-java/trunk/rdb/src/test/resources/basicCustomerMappingWithCUD.xml create mode 100644 das-java/trunk/rdb/src/test/resources/basicCustomerMappingWithCUD2.xml create mode 100644 das-java/trunk/rdb/src/test/resources/basicCustomerMappingWithInvalidCUD.xml create mode 100644 das-java/trunk/rdb/src/test/resources/basicCustomerOrderMapping.xml create mode 100644 das-java/trunk/rdb/src/test/resources/basicStaticCustomer.xml create mode 100644 das-java/trunk/rdb/src/test/resources/cityStates.xml create mode 100644 das-java/trunk/rdb/src/test/resources/company.xsd create mode 100644 das-java/trunk/rdb/src/test/resources/companyMapping.xml create mode 100644 das-java/trunk/rdb/src/test/resources/companyMappingWithConverters.xml create mode 100644 das-java/trunk/rdb/src/test/resources/companyMappingWithResultDescriptor.xml create mode 100644 das-java/trunk/rdb/src/test/resources/companynoid.xsd create mode 100644 das-java/trunk/rdb/src/test/resources/companynoidMappingWithConverters.xml create mode 100644 das-java/trunk/rdb/src/test/resources/connectionInfoDriverManagerAuth.xml create mode 100644 das-java/trunk/rdb/src/test/resources/connectionInfoDriverManagerNoAuth.xml create mode 100644 das-java/trunk/rdb/src/test/resources/customer.xsd create mode 100644 das-java/trunk/rdb/src/test/resources/customerMapping.xml create mode 100644 das-java/trunk/rdb/src/test/resources/customerMappingWithResultDescriptor.xml create mode 100644 das-java/trunk/rdb/src/test/resources/customerOrderRelationshipMapping.xml create mode 100644 das-java/trunk/rdb/src/test/resources/moin-www.png create mode 100644 das-java/trunk/rdb/src/test/resources/namedParameter.xml create mode 100644 das-java/trunk/rdb/src/test/resources/passiveConnection.xml create mode 100644 das-java/trunk/rdb/src/test/resources/staticCustomer.xml create mode 100644 das-java/trunk/rdb/src/test/resources/staticCustomerOrder.xml create mode 100644 das-java/trunk/rdb/src/test/resources/staticInvalid.xml create mode 100644 das-java/trunk/rdb/src/test/resources/storedProcTest.xml create mode 100644 das-java/trunk/samples/Readme.htm create mode 100644 das-java/trunk/samples/advanced-webapp/build.xml create mode 100644 das-java/trunk/samples/advanced-webapp/pom.xml create mode 100644 das-java/trunk/samples/advanced-webapp/readme.htm create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/DASQueryProcessor.java create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/SillyDateStringConverter.java create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/StringToLongConverter.java create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/util/XmlUtil.java create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/CommandServlet.java create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/ServiceProcessor.java create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/resources/AjaxDBConfig.xml create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/resources/CustomerConfigWithConverter.xml create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/resources/CustomerConfigWithIDConverter.xml create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/resources/DasConfig.xml create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/LICENSE create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/NOTICE create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/README create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/resources/log4j.properties create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/webapp/META-INF/context.xml create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/c.tld create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/fmt.tld create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/webapp/html/DASWebSampleFrame.html create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/webapp/html/blank.html create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/webapp/js/ajax.js create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/webapp/js/dasmenu.js create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/DASMenu.jsp create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/converter.jsp create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/default.css create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/indexAdhoc.jsp create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/indexCommand.jsp create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/main.css create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/occ.jsp create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/rss.jsp create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/company.xsl create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/companyDepartment.xsl create mode 100644 das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/customer.xsl create mode 100644 das-java/trunk/samples/build.xml create mode 100644 das-java/trunk/samples/company-webapp/build.xml create mode 100644 das-java/trunk/samples/company-webapp/dastest/db.lck create mode 100644 das-java/trunk/samples/company-webapp/dastest/log/log.ctrl create mode 100644 das-java/trunk/samples/company-webapp/dastest/log/log1.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/log/logmirror.ctrl create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c10.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c101.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c111.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c121.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c130.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c141.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c150.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c161.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c171.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c180.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c191.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c1a1.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c1b1.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c1c0.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c1d1.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c1e0.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c1f1.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c20.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c200.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c211.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c221.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c230.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c241.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c251.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c260.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c271.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c281.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c290.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c2a1.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c2b1.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c2c1.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c2d0.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c2e1.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c2f0.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c300.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c31.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c311.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c320.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c331.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c340.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c351.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c360.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c371.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c380.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c391.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c3a0.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c3b1.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c3c0.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c3d1.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c3e0.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c3f1.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c400.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c41.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c411.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c420.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c431.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c440.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c451.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c460.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c471.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c481.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c490.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c4a1.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c51.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c60.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c71.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c81.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/c90.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/ca1.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/cb1.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/cc0.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/cd1.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/ce1.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/seg0/cf0.dat create mode 100644 das-java/trunk/samples/company-webapp/dastest/service.properties create mode 100644 das-java/trunk/samples/company-webapp/pom.xml create mode 100644 das-java/trunk/samples/company-webapp/readme.htm create mode 100644 das-java/trunk/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyClient.java create mode 100644 das-java/trunk/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyDBInit.java create mode 100644 das-java/trunk/samples/company-webapp/src/main/resources/CompanyConfig.xml create mode 100644 das-java/trunk/samples/company-webapp/src/main/resources/CompanyWebDBConfig.xml create mode 100644 das-java/trunk/samples/company-webapp/src/main/resources/META-INF/LICENSE create mode 100644 das-java/trunk/samples/company-webapp/src/main/resources/META-INF/NOTICE create mode 100644 das-java/trunk/samples/company-webapp/src/main/resources/META-INF/README create mode 100644 das-java/trunk/samples/company-webapp/src/main/resources/log4j.properties create mode 100644 das-java/trunk/samples/company-webapp/src/main/webapp/Company.jsp create mode 100644 das-java/trunk/samples/company-webapp/src/main/webapp/META-INF/context.xml create mode 100644 das-java/trunk/samples/company-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 das-java/trunk/samples/customer/build.xml create mode 100644 das-java/trunk/samples/customer/pom.xml create mode 100644 das-java/trunk/samples/customer/readme.htm create mode 100644 das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerClient.java create mode 100644 das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerDatabaseInitializer.java create mode 100644 das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetup.java create mode 100644 das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DerbySetup.java create mode 100644 das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/MySQLSetup.java create mode 100644 das-java/trunk/samples/customer/src/main/resources/CustomersConfig.xml create mode 100644 das-java/trunk/samples/customer/src/main/resources/META-INF/LICENSE create mode 100644 das-java/trunk/samples/customer/src/main/resources/META-INF/NOTICE create mode 100644 das-java/trunk/samples/customer/src/main/resources/META-INF/README create mode 100644 das-java/trunk/samples/customer/src/main/resources/log4j.properties create mode 100644 das-java/trunk/samples/dbconfig/pom.xml create mode 100644 das-java/trunk/samples/dbconfig/readme.html create mode 100644 das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConfigUtil.java create mode 100644 das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConnectionHelper.java create mode 100644 das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBDataHelper.java create mode 100644 das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBHelper.java create mode 100644 das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializer.java create mode 100644 das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DataSourceInitializationException.java create mode 100644 das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DatabaseInitializerException.java create mode 100644 das-java/trunk/samples/dbconfig/src/main/resources/CannedSampleDBConfig.xml create mode 100644 das-java/trunk/samples/dbconfig/src/main/resources/DBConfig.xsd create mode 100644 das-java/trunk/samples/dbconfig/src/main/resources/META-INF/LICENSE create mode 100644 das-java/trunk/samples/dbconfig/src/main/resources/META-INF/NOTICE create mode 100644 das-java/trunk/samples/dbconfig/src/main/resources/META-INF/README create mode 100644 das-java/trunk/samples/dbconfig/src/main/resources/log4j.properties create mode 100644 das-java/trunk/samples/dbconfig/src/test/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializerTestCase.java create mode 100644 das-java/trunk/samples/dbconfig/src/test/resources/dbConfig.xml create mode 100644 das-java/trunk/samples/pom.xml create mode 100644 das-java/trunk/samples/testing/tomcat/advanced-webapp/pom.xml create mode 100644 das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/LICENSE create mode 100644 das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/NOTICE create mode 100644 das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/README create mode 100644 das-java/trunk/samples/testing/tomcat/advanced-webapp/src/test/java/org/apache/tuscany/test/das/AjaxDasTestCase.java create mode 100644 das-java/trunk/samples/testing/tomcat/build.xml create mode 100644 das-java/trunk/samples/testing/tomcat/company-webapp/pom.xml create mode 100644 das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/LICENSE create mode 100644 das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/NOTICE create mode 100644 das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/README create mode 100644 das-java/trunk/samples/testing/tomcat/company-webapp/src/test/java/org/apache/tuscany/test/das/DasTestCase.java create mode 100644 das-java/trunk/samples/testing/tomcat/context.xsl create mode 100644 das-java/trunk/samples/testing/tomcat/datasource.xsl create mode 100644 das-java/trunk/samples/testing/tomcat/pom.xml create mode 100644 das-java/trunk/samples/testing/tomcat/readme.htm create mode 100644 das-java/trunk/samples/testing/tomcat/server.xsl create mode 100644 das-java/trunk/samples/transaction/build.xml create mode 100644 das-java/trunk/samples/transaction/pom.xml create mode 100644 das-java/trunk/samples/transaction/readme.htm create mode 100644 das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetupUtil.java create mode 100644 das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerService.java create mode 100644 das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerUtil.java create mode 100644 das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/sample/MoneyTransfer.java create mode 100644 das-java/trunk/samples/transaction/src/main/resources/BankAccountDBConfig.xml create mode 100644 das-java/trunk/samples/transaction/src/main/resources/BankAccounts.xml create mode 100644 das-java/trunk/tools/pom.xml create mode 100644 das-java/trunk/tools/readme.htm create mode 100644 das-java/trunk/tools/src/main/java/org/apache/tuscany/das/rdb/util/Column.java create mode 100644 das-java/trunk/tools/src/main/java/org/apache/tuscany/das/rdb/util/DBSchema.java create mode 100644 das-java/trunk/tools/src/main/java/org/apache/tuscany/das/rdb/util/DBToSchemaFile.java create mode 100644 das-java/trunk/tools/src/main/java/org/apache/tuscany/das/rdb/util/DBToXSDGenerator.java create mode 100644 das-java/trunk/tools/src/main/java/org/apache/tuscany/das/rdb/util/ForeignKey.java create mode 100644 das-java/trunk/tools/src/main/java/org/apache/tuscany/das/rdb/util/ForeignKeyRef.java create mode 100644 das-java/trunk/tools/src/main/java/org/apache/tuscany/das/rdb/util/ModelXSDGenOption.java create mode 100644 das-java/trunk/tools/src/main/java/org/apache/tuscany/das/rdb/util/SQLTypeChecker.java create mode 100644 das-java/trunk/tools/src/main/java/org/apache/tuscany/das/rdb/util/SchemaFileToXSD.java create mode 100644 das-java/trunk/tools/src/main/java/org/apache/tuscany/das/rdb/util/Table.java create mode 100644 das-java/trunk/tools/src/test/java/org/apache/tuscany/das/rdb/test/DBToXSDTests.java create mode 100644 das-java/trunk/tools/src/test/resources/DBConnectionConfig.xml create mode 100644 das-java/trunk/tools/src/test/resources/dbConfig.xml delete mode 100644 java/das/distribution/binary/DISCLAIMER delete mode 100644 java/das/distribution/binary/LICENSE delete mode 100644 java/das/distribution/binary/NOTICE delete mode 100644 java/das/distribution/binary/README delete mode 100644 java/das/distribution/binary/RELEASE_NOTES delete mode 100644 java/das/distribution/binary/pom.xml delete mode 100644 java/das/distribution/binary/src/main/assembly/das.xml delete mode 100644 java/das/distribution/source/BUILDING delete mode 100644 java/das/distribution/source/DISCLAIMER delete mode 100644 java/das/distribution/source/LICENSE delete mode 100644 java/das/distribution/source/NOTICE delete mode 100644 java/das/distribution/source/README delete mode 100644 java/das/distribution/source/RELEASE_NOTES delete mode 100644 java/das/distribution/source/pom.xml delete mode 100644 java/das/distribution/source/src/main/assembly/src.xml delete mode 100644 java/das/plugin/pom.xml delete mode 100644 java/das/plugin/src/main/java/org/apache/tuscany/das/plugin/GeneratorMojo.java delete mode 100644 java/das/pom.xml delete mode 100644 java/das/rdb/pom.xml delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Command.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ConfigHelper.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Converter.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/DAS.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/DASFactory.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Pager.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/MappingWrapper.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/QualifiedColumn.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/RelationshipWrapper.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/TableWrapper.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/exception/DataSourceInitializationException.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/exception/OptimisticConcurrencyException.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/BaseGenerator.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/DeleteGenerator.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/InsertGenerator.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/UpdateGenerator.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DefaultConverter.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/GraphBuilderMetadata.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/MultiTableRegistry.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetProcessor.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetRow.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/RowObjects.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/SingleTableRegistry.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableRegistry.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ResultSetTypeMap.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ApplyChangesCommandImpl.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/BaseCommandImpl.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeFactory.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeOperation.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeSummarizer.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Changes.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CollisionParameter.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandImpl.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CreateOperation.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASFactoryImpl.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASImpl.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DatabaseObject.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteCommandImpl.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteList.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteOperation.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/FactoryRegistry.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertCommandImpl.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertList.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ManagedParameterImpl.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/OptimisticWriteCommandImpl.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/PagerImpl.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterExtendedImpl.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterImpl.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Parameters.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParametersExtendedImpl.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ReadCommandImpl.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ResultSetShape.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypeHelper.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypes.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SPCommandImpl.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Statement.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateCommandImpl.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateList.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateOperation.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/WriteCommandImpl.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/merge/impl/GraphMerger.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/CollectionsUtil.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/ConfigUtil.java delete mode 100644 java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DataObjectUtil.java delete mode 100644 java/das/rdb/src/main/resources/META-INF/DISCLAIMER delete mode 100644 java/das/rdb/src/main/resources/META-INF/LICENSE delete mode 100644 java/das/rdb/src/main/resources/META-INF/NOTICE delete mode 100644 java/das/rdb/src/main/resources/META-INF/README delete mode 100644 java/das/rdb/src/main/resources/config.xsd delete mode 100644 java/das/rdb/src/main/resources/dasmodel4.mdl delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/AliasTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/BestPracticeTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CUDGeneration.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CheckSupportGeneratedKeys.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyRelationshipTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConnectionTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DynamicResultDescriptorTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedCommandTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedId.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GraphMergeTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ImpliedRelationshipTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/KennelTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/LOBTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/MissingPKTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/MultiSchemaTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/NamedParameterTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OCCTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OneToOneRelationshipTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OperationOrderingTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/Paging.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PartialUpdateTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PassiveConnectionTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ProgrammaticConfigTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ReadDBSchemaTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RecursiveTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ResultSetShapeTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SerializationTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SimplestCrud.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/StoredProcs.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TopDown.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TransactionTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TypeTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersByLastnameCommand.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersCommand.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersWithShapeCommand.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/SimpleReadCustomersWithShapeCommand.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/BookData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CityData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyDeptData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyEmpData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CustomerData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepEmpData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DocumentsImagesData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DogData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/EmployeeData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/KennelData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/MultiSchemaData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsDescriptionData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OwnerData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OwnerDogData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/PartData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/ProductData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/ProductProdSpecData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/ProductSpecData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SingerData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/SongData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/StateData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/TypesData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/VisitData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DB2Setup.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DasTest.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DatabaseSetup.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DerbySetup.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/JavaStoredProcs.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/MySQLSetup.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/RelationshipData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestData.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestDataWithExplicitColumns.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/IntegerToBooleanConverter.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/SillyDateStringConverter.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringObfuscationConverter.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToIntegerConverter.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToLongConverter.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllCommonTests.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDB2.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDerby.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsMySQL.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/typed/SimplestStaticCrud.java delete mode 100644 java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/util/PrintPropertiesOfDataObject.java delete mode 100644 java/das/rdb/src/test/resources/1xM_mapping_no_cud.xml delete mode 100644 java/das/rdb/src/test/resources/BooksConfig.xml delete mode 100644 java/das/rdb/src/test/resources/BooksConfigWithAlias.xml delete mode 100644 java/das/rdb/src/test/resources/CompanyConfig.xml delete mode 100644 java/das/rdb/src/test/resources/CompanyEmployeeConfig.xml delete mode 100644 java/das/rdb/src/test/resources/CustomerConfig.xml delete mode 100644 java/das/rdb/src/test/resources/CustomerConfigWithConverter.xml delete mode 100644 java/das/rdb/src/test/resources/CustomerConfigWithConverter2.xml delete mode 100644 java/das/rdb/src/test/resources/CustomerConfigWithIDConverter.xml delete mode 100644 java/das/rdb/src/test/resources/CustomersOrdersConfig.xml delete mode 100644 java/das/rdb/src/test/resources/CustomersOrdersConfigProps.xml delete mode 100644 java/das/rdb/src/test/resources/CustomersOrdersRelationship.xml delete mode 100644 java/das/rdb/src/test/resources/InvalidConfig1.xml delete mode 100644 java/das/rdb/src/test/resources/InvalidConverter.xml delete mode 100644 java/das/rdb/src/test/resources/ManagedBooksConfig.xml delete mode 100644 java/das/rdb/src/test/resources/MissingPK.xml delete mode 100644 java/das/rdb/src/test/resources/MissingPKREL.xml delete mode 100644 java/das/rdb/src/test/resources/MultiSchemaDasConfig1.xml delete mode 100644 java/das/rdb/src/test/resources/MultiSchemaDasConfig12.xml delete mode 100644 java/das/rdb/src/test/resources/MultiSchemaDasConfig13.xml delete mode 100644 java/das/rdb/src/test/resources/MultiSchemaDasConfig14.xml delete mode 100644 java/das/rdb/src/test/resources/MultiSchemaDasConfig2.xml delete mode 100644 java/das/rdb/src/test/resources/MultiSchemaDasConfig3.xml delete mode 100644 java/das/rdb/src/test/resources/MultiSchemaDasConfig5.xml delete mode 100644 java/das/rdb/src/test/resources/MultiSchemaDasConfig6.xml delete mode 100644 java/das/rdb/src/test/resources/MultiSchemaDasConfig7.xml delete mode 100644 java/das/rdb/src/test/resources/MultiSchemaDasConfig8.xml delete mode 100644 java/das/rdb/src/test/resources/MultiSchemaDasConfig9.xml delete mode 100644 java/das/rdb/src/test/resources/MultiSchemaInvalidDasConfig.xml delete mode 100644 java/das/rdb/src/test/resources/OneToOneNonRestrictedConfig.xml delete mode 100644 java/das/rdb/src/test/resources/OneToOneRestrictedConfig.xml delete mode 100644 java/das/rdb/src/test/resources/OrderDetailsAndDescription.xml delete mode 100644 java/das/rdb/src/test/resources/OrdersOrderDetailsConfig.xml delete mode 100644 java/das/rdb/src/test/resources/PartsConfig.xml delete mode 100644 java/das/rdb/src/test/resources/SINGER.xsd delete mode 100644 java/das/rdb/src/test/resources/asciifile.txt delete mode 100644 java/das/rdb/src/test/resources/basicCompanyDepartmentMapping.xml delete mode 100644 java/das/rdb/src/test/resources/basicCompanyMapping.xml delete mode 100644 java/das/rdb/src/test/resources/basicCustomerMapping.xml delete mode 100644 java/das/rdb/src/test/resources/basicCustomerMappingWithCUD.xml delete mode 100644 java/das/rdb/src/test/resources/basicCustomerMappingWithCUD2.xml delete mode 100644 java/das/rdb/src/test/resources/basicCustomerMappingWithInvalidCUD.xml delete mode 100644 java/das/rdb/src/test/resources/basicCustomerOrderMapping.xml delete mode 100644 java/das/rdb/src/test/resources/basicStaticCustomer.xml delete mode 100644 java/das/rdb/src/test/resources/cityStates.xml delete mode 100644 java/das/rdb/src/test/resources/company.xsd delete mode 100644 java/das/rdb/src/test/resources/companyMapping.xml delete mode 100644 java/das/rdb/src/test/resources/companyMappingWithConverters.xml delete mode 100644 java/das/rdb/src/test/resources/companyMappingWithResultDescriptor.xml delete mode 100644 java/das/rdb/src/test/resources/companynoid.xsd delete mode 100644 java/das/rdb/src/test/resources/companynoidMappingWithConverters.xml delete mode 100644 java/das/rdb/src/test/resources/connectionInfoDriverManagerAuth.xml delete mode 100644 java/das/rdb/src/test/resources/connectionInfoDriverManagerNoAuth.xml delete mode 100644 java/das/rdb/src/test/resources/customer.xsd delete mode 100644 java/das/rdb/src/test/resources/customerMapping.xml delete mode 100644 java/das/rdb/src/test/resources/customerMappingWithResultDescriptor.xml delete mode 100644 java/das/rdb/src/test/resources/customerOrderRelationshipMapping.xml delete mode 100644 java/das/rdb/src/test/resources/moin-www.png delete mode 100644 java/das/rdb/src/test/resources/namedParameter.xml delete mode 100644 java/das/rdb/src/test/resources/passiveConnection.xml delete mode 100644 java/das/rdb/src/test/resources/staticCustomer.xml delete mode 100644 java/das/rdb/src/test/resources/staticCustomerOrder.xml delete mode 100644 java/das/rdb/src/test/resources/staticInvalid.xml delete mode 100644 java/das/rdb/src/test/resources/storedProcTest.xml delete mode 100644 java/das/samples/Readme.htm delete mode 100644 java/das/samples/advanced-webapp/build.xml delete mode 100644 java/das/samples/advanced-webapp/pom.xml delete mode 100644 java/das/samples/advanced-webapp/readme.htm delete mode 100644 java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/DASQueryProcessor.java delete mode 100644 java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/SillyDateStringConverter.java delete mode 100644 java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/StringToLongConverter.java delete mode 100644 java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/util/XmlUtil.java delete mode 100644 java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/CommandServlet.java delete mode 100644 java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/ServiceProcessor.java delete mode 100644 java/das/samples/advanced-webapp/src/main/resources/AjaxDBConfig.xml delete mode 100644 java/das/samples/advanced-webapp/src/main/resources/CustomerConfigWithConverter.xml delete mode 100644 java/das/samples/advanced-webapp/src/main/resources/CustomerConfigWithIDConverter.xml delete mode 100644 java/das/samples/advanced-webapp/src/main/resources/DasConfig.xml delete mode 100644 java/das/samples/advanced-webapp/src/main/resources/META-INF/LICENSE delete mode 100644 java/das/samples/advanced-webapp/src/main/resources/META-INF/NOTICE delete mode 100644 java/das/samples/advanced-webapp/src/main/resources/META-INF/README delete mode 100644 java/das/samples/advanced-webapp/src/main/resources/log4j.properties delete mode 100644 java/das/samples/advanced-webapp/src/main/webapp/META-INF/context.xml delete mode 100644 java/das/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/c.tld delete mode 100644 java/das/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/fmt.tld delete mode 100644 java/das/samples/advanced-webapp/src/main/webapp/WEB-INF/web.xml delete mode 100644 java/das/samples/advanced-webapp/src/main/webapp/html/DASWebSampleFrame.html delete mode 100644 java/das/samples/advanced-webapp/src/main/webapp/html/blank.html delete mode 100644 java/das/samples/advanced-webapp/src/main/webapp/js/ajax.js delete mode 100644 java/das/samples/advanced-webapp/src/main/webapp/js/dasmenu.js delete mode 100644 java/das/samples/advanced-webapp/src/main/webapp/jsp/DASMenu.jsp delete mode 100644 java/das/samples/advanced-webapp/src/main/webapp/jsp/converter.jsp delete mode 100644 java/das/samples/advanced-webapp/src/main/webapp/jsp/default.css delete mode 100644 java/das/samples/advanced-webapp/src/main/webapp/jsp/indexAdhoc.jsp delete mode 100644 java/das/samples/advanced-webapp/src/main/webapp/jsp/indexCommand.jsp delete mode 100644 java/das/samples/advanced-webapp/src/main/webapp/jsp/main.css delete mode 100644 java/das/samples/advanced-webapp/src/main/webapp/jsp/occ.jsp delete mode 100644 java/das/samples/advanced-webapp/src/main/webapp/jsp/rss.jsp delete mode 100644 java/das/samples/advanced-webapp/src/main/webapp/xsl/company.xsl delete mode 100644 java/das/samples/advanced-webapp/src/main/webapp/xsl/companyDepartment.xsl delete mode 100644 java/das/samples/advanced-webapp/src/main/webapp/xsl/customer.xsl delete mode 100644 java/das/samples/build.xml delete mode 100644 java/das/samples/company-webapp/build.xml delete mode 100644 java/das/samples/company-webapp/dastest/db.lck delete mode 100644 java/das/samples/company-webapp/dastest/log/log.ctrl delete mode 100644 java/das/samples/company-webapp/dastest/log/log1.dat delete mode 100644 java/das/samples/company-webapp/dastest/log/logmirror.ctrl delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c10.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c101.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c111.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c121.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c130.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c141.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c150.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c161.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c171.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c180.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c191.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c1a1.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c1b1.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c1c0.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c1d1.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c1e0.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c1f1.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c20.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c200.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c211.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c221.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c230.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c241.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c251.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c260.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c271.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c281.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c290.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c2a1.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c2b1.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c2c1.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c2d0.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c2e1.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c2f0.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c300.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c31.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c311.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c320.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c331.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c340.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c351.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c360.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c371.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c380.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c391.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c3a0.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c3b1.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c3c0.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c3d1.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c3e0.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c3f1.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c400.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c41.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c411.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c420.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c431.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c440.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c451.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c460.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c471.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c481.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c490.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c4a1.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c51.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c60.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c71.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c81.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/c90.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/ca1.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/cb1.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/cc0.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/cd1.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/ce1.dat delete mode 100644 java/das/samples/company-webapp/dastest/seg0/cf0.dat delete mode 100644 java/das/samples/company-webapp/dastest/service.properties delete mode 100644 java/das/samples/company-webapp/pom.xml delete mode 100644 java/das/samples/company-webapp/readme.htm delete mode 100644 java/das/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyClient.java delete mode 100644 java/das/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyDBInit.java delete mode 100644 java/das/samples/company-webapp/src/main/resources/CompanyConfig.xml delete mode 100644 java/das/samples/company-webapp/src/main/resources/CompanyWebDBConfig.xml delete mode 100644 java/das/samples/company-webapp/src/main/resources/META-INF/LICENSE delete mode 100644 java/das/samples/company-webapp/src/main/resources/META-INF/NOTICE delete mode 100644 java/das/samples/company-webapp/src/main/resources/META-INF/README delete mode 100644 java/das/samples/company-webapp/src/main/resources/log4j.properties delete mode 100644 java/das/samples/company-webapp/src/main/webapp/Company.jsp delete mode 100644 java/das/samples/company-webapp/src/main/webapp/META-INF/context.xml delete mode 100644 java/das/samples/company-webapp/src/main/webapp/WEB-INF/web.xml delete mode 100644 java/das/samples/customer/build.xml delete mode 100644 java/das/samples/customer/pom.xml delete mode 100644 java/das/samples/customer/readme.htm delete mode 100644 java/das/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerClient.java delete mode 100644 java/das/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerDatabaseInitializer.java delete mode 100644 java/das/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetup.java delete mode 100644 java/das/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DerbySetup.java delete mode 100644 java/das/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/MySQLSetup.java delete mode 100644 java/das/samples/customer/src/main/resources/CustomersConfig.xml delete mode 100644 java/das/samples/customer/src/main/resources/META-INF/LICENSE delete mode 100644 java/das/samples/customer/src/main/resources/META-INF/NOTICE delete mode 100644 java/das/samples/customer/src/main/resources/META-INF/README delete mode 100644 java/das/samples/customer/src/main/resources/log4j.properties delete mode 100644 java/das/samples/dbconfig/pom.xml delete mode 100644 java/das/samples/dbconfig/readme.html delete mode 100644 java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConfigUtil.java delete mode 100644 java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConnectionHelper.java delete mode 100644 java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBDataHelper.java delete mode 100644 java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBHelper.java delete mode 100644 java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializer.java delete mode 100644 java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DataSourceInitializationException.java delete mode 100644 java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DatabaseInitializerException.java delete mode 100644 java/das/samples/dbconfig/src/main/resources/CannedSampleDBConfig.xml delete mode 100644 java/das/samples/dbconfig/src/main/resources/DBConfig.xsd delete mode 100644 java/das/samples/dbconfig/src/main/resources/META-INF/LICENSE delete mode 100644 java/das/samples/dbconfig/src/main/resources/META-INF/NOTICE delete mode 100644 java/das/samples/dbconfig/src/main/resources/META-INF/README delete mode 100644 java/das/samples/dbconfig/src/main/resources/log4j.properties delete mode 100644 java/das/samples/dbconfig/src/test/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializerTestCase.java delete mode 100644 java/das/samples/dbconfig/src/test/resources/dbConfig.xml delete mode 100644 java/das/samples/pom.xml delete mode 100644 java/das/samples/testing/tomcat/advanced-webapp/pom.xml delete mode 100644 java/das/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/LICENSE delete mode 100644 java/das/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/NOTICE delete mode 100644 java/das/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/README delete mode 100644 java/das/samples/testing/tomcat/advanced-webapp/src/test/java/org/apache/tuscany/test/das/AjaxDasTestCase.java delete mode 100644 java/das/samples/testing/tomcat/build.xml delete mode 100644 java/das/samples/testing/tomcat/company-webapp/pom.xml delete mode 100644 java/das/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/LICENSE delete mode 100644 java/das/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/NOTICE delete mode 100644 java/das/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/README delete mode 100644 java/das/samples/testing/tomcat/company-webapp/src/test/java/org/apache/tuscany/test/das/DasTestCase.java delete mode 100644 java/das/samples/testing/tomcat/context.xsl delete mode 100644 java/das/samples/testing/tomcat/datasource.xsl delete mode 100644 java/das/samples/testing/tomcat/pom.xml delete mode 100644 java/das/samples/testing/tomcat/readme.htm delete mode 100644 java/das/samples/testing/tomcat/server.xsl delete mode 100644 java/das/samples/transaction/build.xml delete mode 100644 java/das/samples/transaction/pom.xml delete mode 100644 java/das/samples/transaction/readme.htm delete mode 100644 java/das/samples/transaction/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetupUtil.java delete mode 100644 java/das/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerService.java delete mode 100644 java/das/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerUtil.java delete mode 100644 java/das/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/sample/MoneyTransfer.java delete mode 100644 java/das/samples/transaction/src/main/resources/BankAccountDBConfig.xml delete mode 100644 java/das/samples/transaction/src/main/resources/BankAccounts.xml delete mode 100644 java/das/tools/pom.xml delete mode 100644 java/das/tools/readme.htm delete mode 100644 java/das/tools/src/main/java/org/apache/tuscany/das/rdb/util/Column.java delete mode 100644 java/das/tools/src/main/java/org/apache/tuscany/das/rdb/util/DBSchema.java delete mode 100644 java/das/tools/src/main/java/org/apache/tuscany/das/rdb/util/DBToSchemaFile.java delete mode 100644 java/das/tools/src/main/java/org/apache/tuscany/das/rdb/util/DBToXSDGenerator.java delete mode 100644 java/das/tools/src/main/java/org/apache/tuscany/das/rdb/util/ForeignKey.java delete mode 100644 java/das/tools/src/main/java/org/apache/tuscany/das/rdb/util/ForeignKeyRef.java delete mode 100644 java/das/tools/src/main/java/org/apache/tuscany/das/rdb/util/ModelXSDGenOption.java delete mode 100644 java/das/tools/src/main/java/org/apache/tuscany/das/rdb/util/SQLTypeChecker.java delete mode 100644 java/das/tools/src/main/java/org/apache/tuscany/das/rdb/util/SchemaFileToXSD.java delete mode 100644 java/das/tools/src/main/java/org/apache/tuscany/das/rdb/util/Table.java delete mode 100644 java/das/tools/src/test/java/org/apache/tuscany/das/rdb/test/DBToXSDTests.java delete mode 100644 java/das/tools/src/test/resources/DBConnectionConfig.xml delete mode 100644 java/das/tools/src/test/resources/dbConfig.xml diff --git a/das-java/trunk/distribution/binary/DISCLAIMER b/das-java/trunk/distribution/binary/DISCLAIMER new file mode 100644 index 0000000000..a65af91c5a --- /dev/null +++ b/das-java/trunk/distribution/binary/DISCLAIMER @@ -0,0 +1,7 @@ +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache 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. \ No newline at end of file diff --git a/das-java/trunk/distribution/binary/LICENSE b/das-java/trunk/distribution/binary/LICENSE new file mode 100644 index 0000000000..9597d92eb3 --- /dev/null +++ b/das-java/trunk/distribution/binary/LICENSE @@ -0,0 +1,353 @@ + + 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. + +=============================================================================================================== + +Other components and dependencies under Apache Software License 2.0 : + + log4j-1.2.14.jar - Apache Logging Services + derby 10.2.2.0.jar - Apache Derby + stax-api-1.0.1.jar - The Streaming API for XML (StAX) + wstx-asl-3.2.0.jar - WoodStox StAX implementation + standard-1.1.1.jar - The Apache Jackarta Taglibs + jstl-1.1.2.jar - The Apache Jackarta Taglibs + *.tld - The Apache Jackarta Taglibs + +=============================================================================================================== + + +Apache Tuscany SDO for Java Subcomponents +=========================================: + +The Tuscany SDO for Java release 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. + +License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar) + +Permission to copy, make derivative works of, and distribute the Service Data Objects +JavaDoc and Interface Definition Files files in any medium without fee or royalty as part +of a compliant implementation of the Service Data Objects Specification is hereby granted. +The Service Data Objects Specification may be found at any of the following locations: + +http://dev2dev.bea.com/technologies/commonj/index.jsp +http://www.ibm.com/developerworks/library/specification/ws-sdo/ +http://oracle.com/technology/webservices/sca +https://www.sdn.sap.com/ +http://www.xcalia/xdn/specs/sdo + +THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES +ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS +SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS, +INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE +SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES. + +The name and trademarks of the Authors may NOT be used in any manner, including advertising or +publicity pertaining to the Service Component Architecture Specification or its contents without specific, +written prior permission. Title to copyright in the Service Data Objects Specification and the +JavaDoc and Interface Definition Files will at all times remain with the Authors. + +No other rights are granted by implication, estoppel or otherwise. + +================================================================================================================= + +For the Eclipse EMF components +(codegen-2.2.3.jar +codegen-ecore-2.2.3.jar +common-2.2.3.jar +ecore-2.2.3.jar +ecore-change-2.2.3.jar +ecore-xmi-2.2.3.jar +xsd-2.2.3.jar) + +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. + +=================================================================================================== diff --git a/das-java/trunk/distribution/binary/NOTICE b/das-java/trunk/distribution/binary/NOTICE new file mode 100644 index 0000000000..69a83ad3a1 --- /dev/null +++ b/das-java/trunk/distribution/binary/NOTICE @@ -0,0 +1,24 @@ +Apache Tuscany SDO for Java +Copyright 2006, 2007 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +Unless otherwise indicated, all distribution made available by the Apache Software Foundation +is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL"). +A copy of the AL is provided with this distribution as the LICENSE file present in the +root directory, and is also available at http://www.apache.org/licenses/. + +The terms and conditions governing the distribution may refer to the AL or other license +agreements, notices or terms and conditions. Some of these other license agreements may +include (but are not limited to): + + . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html) + +It is your obligation to read and accept all such terms and conditions prior to use of the +distribution. If term or condition is provided, please contact the Apache Software Foundation +to determine what terms and conditions govern that particular distribution. + +This product also includes software developed by the Open Service Oriented Architecture organisation +(http://osoa.org). The license for this software may be found in the LICENSE file contained in this +distribution. diff --git a/das-java/trunk/distribution/binary/README b/das-java/trunk/distribution/binary/README new file mode 100644 index 0000000000..8d292cbb06 --- /dev/null +++ b/das-java/trunk/distribution/binary/README @@ -0,0 +1,10 @@ + Apache Tuscany + ------------------------------------------- + +Welcome to Tuscany! Please read the release notes (RELEASE_NOTES) in this directory for +details on the current release. + +Thanks from all of us on the Tuscany team for downloading the package; help +us make it better by sending comments to tuscany-user@ws.apache.org. + + diff --git a/das-java/trunk/distribution/binary/RELEASE_NOTES b/das-java/trunk/distribution/binary/RELEASE_NOTES new file mode 100644 index 0000000000..b9c205a75e --- /dev/null +++ b/das-java/trunk/distribution/binary/RELEASE_NOTES @@ -0,0 +1,33 @@ +DAS - Data Access Services + +Service Data Object(SDO) provides a uniform API for handling different types of data. Data Access Service (DAS) +simplifies handling of data when interacting with the back-end data source and frees application developers +from dealing with tedious and error-prone transformation between end source types and SDO Data Object Types/properties.. + +What's new in Apache Tuscany DAS beta2 +====================================== + + The main purpose of the DAS beta2 release is to fix incompatibilites that were found with SDO 1.0 release. + + The following JIRAs also were fixed on DAS beta2 + + - TUSCANY-986 - DAS integration with SDO 2.1 APIs + - TUSCANY-961 - DAS: Using deprected SDO method causes Type lookup failure + - TUSCANY-1353 - Exception attempting to insert rows using DAS w/DataDirect JDBC driver + - TUSCANY-1453 - DAS can't read or write the blob field + - TUSCANY-1463 - Support for Clob and Array fields + - TUSCANY-1462 - Consistent use of Parameters in Config + - TUSCANY-1464 - Wrong query results when SELECT misses PKs + - TUSCANY-1465 - Allow passing ResultDescriptor for dynamic Commands + - TUSCANY-1720 - Modify sample readmes for - steps to run sample with other databases + + + +Details are described below. + + DAS Java beta2 is a superset of previous DAS Java M1,M2 and Beta1 releases. + Anything in these previous releases is also in beta2, but beta2 contains features and bug fixes not present on them. + +Compatibility Concerns + + - SDO Static types should be regenerated based on SDO 1.0 tools. diff --git a/das-java/trunk/distribution/binary/pom.xml b/das-java/trunk/distribution/binary/pom.xml new file mode 100644 index 0000000000..6fec609dac --- /dev/null +++ b/das-java/trunk/distribution/binary/pom.xml @@ -0,0 +1,98 @@ + + + + 4.0.0 + + org.apache.tuscany.das + tuscany-das + 1.0-SNAPSHOT + + + org.apache.tuscany.das.distribution + tuscany-das-bin + pom + Tuscany DAS Distribution (Binary) + Tuscany Distribution for DAS. + + + + org.apache.tuscany.das + tuscany-das-rdb + ${das.version} + + + + org.apache.tuscany.das.samples + tuscany-das-sample-company-webapp + ${das.version} + war + + + + org.apache.tuscany.das.samples + tuscany-das-sample-customer + ${das.version} + + + + org.apache.tuscany.das.samples + tuscany-das-sample-advanced-webapp + ${das.version} + war + + + + org.apache.tuscany.das.samples + tuscany-das-sample-transaction + ${das.version} + + + + org.apache.tuscany.das + tuscany-das-tools + ${das.version} + + + + + install + tuscany-das-${das.version} + + + org.apache.maven.plugins + maven-assembly-plugin + 2.2-beta-3 + + + package + + single + + + + + + src/main/assembly/das.xml + + + + + + diff --git a/das-java/trunk/distribution/binary/src/main/assembly/das.xml b/das-java/trunk/distribution/binary/src/main/assembly/das.xml new file mode 100644 index 0000000000..0d916640fd --- /dev/null +++ b/das-java/trunk/distribution/binary/src/main/assembly/das.xml @@ -0,0 +1,174 @@ + + + + bin + false + + zip + tar.gz + + + + + + tuscany-das-${das.version} + + LICENSE* + NOTICE* + DISCLAIMER* + README* + RELEASE_NOTES* + + + + + + + ../../rdb/target/apidocs + tuscany-das-${das.version}/doc + + + + + + + + ../../samples/company-webapp/readme.htm + tuscany-das-${das.version}/samples/company-webapp + 0644 + + + + ../../samples/company-webapp/target/sample-company-webapp.war + tuscany-das-${das.version}/samples/company-webapp + 0644 + + + + + + + ../../samples/advanced-webapp/readme.htm + tuscany-das-${das.version}/samples/advanced-webapp + 0644 + + + + ../../samples/advanced-webapp/target/sample-advanced-webapp.war + tuscany-das-${das.version}/samples/advanced-webapp + 0644 + + + + + + ../../samples/customer/readme.htm + tuscany-das-${das.version}/samples/customer + 0644 + + + + ../../samples/customer/target/sample-customer.jar + tuscany-das-${das.version}/samples/customer + 0644 + + + ../../samples/customer/build.xml + tuscany-das-${das.version}/samples/customer + 0644 + + + + + ../../samples/transaction/readme.htm + tuscany-das-${das.version}/samples/transaction + 0644 + + + + ../../samples/transaction/target/sample-transaction.jar + tuscany-das-${das.version}/samples/transaction + 0644 + + + ../../samples/transaction/build.xml + tuscany-das-${das.version}/samples/transaction + 0644 + + + + + ../../tools/readme.htm + tuscany-das-${das.version}/tuscany-das-tools + 0644 + + + + ../../tools/target/tuscany-das-tools.jar + tuscany-das-${das.version}/tuscany-das-tools + 0644 + + + + + + + + + tuscany-das-${das.version}/lib + + org.apache.tuscany.das:tuscany-das-rdb + + 0644 + + + + + tuscany-das-${das.version}/samples/customer + + org.apache.derby:derby + + 0644 + + + + + tuscany-das-${das.version}/samples/transaction + + mysql:mysql-connector-java + org.apache.geronimo.specs:geronimo-jta_1.1_spec + org.apache.geronimo.components:geronimo-transaction + org.apache.geronimo.specs:geronimo-j2ee-connector_1.5_spec + org.apache.tuscany.das.samples:tuscany-das-sample-dbconfig + + 0644 + + + + + tuscany-das-${das.version}/tuscany-das-tools + + torque:torque-gen + + 0644 + + + + diff --git a/das-java/trunk/distribution/source/BUILDING b/das-java/trunk/distribution/source/BUILDING new file mode 100644 index 0000000000..edc05e6cec --- /dev/null +++ b/das-java/trunk/distribution/source/BUILDING @@ -0,0 +1,47 @@ +Building the Apache Tuscany DAS beta1 +===================================== + +Initial Setup +------------- + +1) Install J2SE 5.0 SDK, which can be downloaded from + http://java.sun.com/j2se/1.5.0/download.jsp. Use version of 1.5.0_06 JDK. + +2) Make sure that your JAVA_HOME environment variable is set to the newly installed + JDK location, and that your PATH includes %JAVA_HOME%\bin (windows) or + $JAVA_HOME$/bin (unix). + +3) Install Maven 2.0.5, which can be downloaded from http://maven.apache.org/download.html. + Make sure that your PATH includes the MVN_HOME/bin directory. + + +Building +-------- + +1) Change to the top level directory to Apache Tuscany source distribution. +2) Run + + $> mvn + + This will compile Apache Tuscany DAS and run all of the tests in the source + distribution. + + Depending on the load of remote Maven 2.0 repositories, you may have + to run "mvn" several times utill the required dependencies are + all located in your local maven repository. It usually takes some time for + maven to download required dependencies in the first build. Once all the + dependencies have been downloaded you may use the -o option to run maven + in offline mode, for example, 'mvn clean install -o'. + + +Building the distributions +-------------------------- + +1) Change to the top level directory to Apache Tuscany source distribution. +2) If you haven't run a complete build, please follow the steps above +3) Run + + $> mvn -Pdistribution + + This will build the binary and source distribution with .zip and .gz + formats in the distribution/target directory. diff --git a/das-java/trunk/distribution/source/DISCLAIMER b/das-java/trunk/distribution/source/DISCLAIMER new file mode 100644 index 0000000000..a65af91c5a --- /dev/null +++ b/das-java/trunk/distribution/source/DISCLAIMER @@ -0,0 +1,7 @@ +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache 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. \ No newline at end of file diff --git a/das-java/trunk/distribution/source/LICENSE b/das-java/trunk/distribution/source/LICENSE new file mode 100644 index 0000000000..9597d92eb3 --- /dev/null +++ b/das-java/trunk/distribution/source/LICENSE @@ -0,0 +1,353 @@ + + 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. + +=============================================================================================================== + +Other components and dependencies under Apache Software License 2.0 : + + log4j-1.2.14.jar - Apache Logging Services + derby 10.2.2.0.jar - Apache Derby + stax-api-1.0.1.jar - The Streaming API for XML (StAX) + wstx-asl-3.2.0.jar - WoodStox StAX implementation + standard-1.1.1.jar - The Apache Jackarta Taglibs + jstl-1.1.2.jar - The Apache Jackarta Taglibs + *.tld - The Apache Jackarta Taglibs + +=============================================================================================================== + + +Apache Tuscany SDO for Java Subcomponents +=========================================: + +The Tuscany SDO for Java release 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. + +License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar) + +Permission to copy, make derivative works of, and distribute the Service Data Objects +JavaDoc and Interface Definition Files files in any medium without fee or royalty as part +of a compliant implementation of the Service Data Objects Specification is hereby granted. +The Service Data Objects Specification may be found at any of the following locations: + +http://dev2dev.bea.com/technologies/commonj/index.jsp +http://www.ibm.com/developerworks/library/specification/ws-sdo/ +http://oracle.com/technology/webservices/sca +https://www.sdn.sap.com/ +http://www.xcalia/xdn/specs/sdo + +THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES +ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS +SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS, +INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE +SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES. + +The name and trademarks of the Authors may NOT be used in any manner, including advertising or +publicity pertaining to the Service Component Architecture Specification or its contents without specific, +written prior permission. Title to copyright in the Service Data Objects Specification and the +JavaDoc and Interface Definition Files will at all times remain with the Authors. + +No other rights are granted by implication, estoppel or otherwise. + +================================================================================================================= + +For the Eclipse EMF components +(codegen-2.2.3.jar +codegen-ecore-2.2.3.jar +common-2.2.3.jar +ecore-2.2.3.jar +ecore-change-2.2.3.jar +ecore-xmi-2.2.3.jar +xsd-2.2.3.jar) + +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. + +=================================================================================================== diff --git a/das-java/trunk/distribution/source/NOTICE b/das-java/trunk/distribution/source/NOTICE new file mode 100644 index 0000000000..69a83ad3a1 --- /dev/null +++ b/das-java/trunk/distribution/source/NOTICE @@ -0,0 +1,24 @@ +Apache Tuscany SDO for Java +Copyright 2006, 2007 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +Unless otherwise indicated, all distribution made available by the Apache Software Foundation +is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL"). +A copy of the AL is provided with this distribution as the LICENSE file present in the +root directory, and is also available at http://www.apache.org/licenses/. + +The terms and conditions governing the distribution may refer to the AL or other license +agreements, notices or terms and conditions. Some of these other license agreements may +include (but are not limited to): + + . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html) + +It is your obligation to read and accept all such terms and conditions prior to use of the +distribution. If term or condition is provided, please contact the Apache Software Foundation +to determine what terms and conditions govern that particular distribution. + +This product also includes software developed by the Open Service Oriented Architecture organisation +(http://osoa.org). The license for this software may be found in the LICENSE file contained in this +distribution. diff --git a/das-java/trunk/distribution/source/README b/das-java/trunk/distribution/source/README new file mode 100644 index 0000000000..8d292cbb06 --- /dev/null +++ b/das-java/trunk/distribution/source/README @@ -0,0 +1,10 @@ + Apache Tuscany + ------------------------------------------- + +Welcome to Tuscany! Please read the release notes (RELEASE_NOTES) in this directory for +details on the current release. + +Thanks from all of us on the Tuscany team for downloading the package; help +us make it better by sending comments to tuscany-user@ws.apache.org. + + diff --git a/das-java/trunk/distribution/source/RELEASE_NOTES b/das-java/trunk/distribution/source/RELEASE_NOTES new file mode 100644 index 0000000000..b9c205a75e --- /dev/null +++ b/das-java/trunk/distribution/source/RELEASE_NOTES @@ -0,0 +1,33 @@ +DAS - Data Access Services + +Service Data Object(SDO) provides a uniform API for handling different types of data. Data Access Service (DAS) +simplifies handling of data when interacting with the back-end data source and frees application developers +from dealing with tedious and error-prone transformation between end source types and SDO Data Object Types/properties.. + +What's new in Apache Tuscany DAS beta2 +====================================== + + The main purpose of the DAS beta2 release is to fix incompatibilites that were found with SDO 1.0 release. + + The following JIRAs also were fixed on DAS beta2 + + - TUSCANY-986 - DAS integration with SDO 2.1 APIs + - TUSCANY-961 - DAS: Using deprected SDO method causes Type lookup failure + - TUSCANY-1353 - Exception attempting to insert rows using DAS w/DataDirect JDBC driver + - TUSCANY-1453 - DAS can't read or write the blob field + - TUSCANY-1463 - Support for Clob and Array fields + - TUSCANY-1462 - Consistent use of Parameters in Config + - TUSCANY-1464 - Wrong query results when SELECT misses PKs + - TUSCANY-1465 - Allow passing ResultDescriptor for dynamic Commands + - TUSCANY-1720 - Modify sample readmes for - steps to run sample with other databases + + + +Details are described below. + + DAS Java beta2 is a superset of previous DAS Java M1,M2 and Beta1 releases. + Anything in these previous releases is also in beta2, but beta2 contains features and bug fixes not present on them. + +Compatibility Concerns + + - SDO Static types should be regenerated based on SDO 1.0 tools. diff --git a/das-java/trunk/distribution/source/pom.xml b/das-java/trunk/distribution/source/pom.xml new file mode 100644 index 0000000000..d6fe42ce63 --- /dev/null +++ b/das-java/trunk/distribution/source/pom.xml @@ -0,0 +1,66 @@ + + + + 4.0.0 + + org.apache.tuscany.das + tuscany-das + 1.0-SNAPSHOT + + + org.apache.tuscany.das.distribution + tuscany-das-src + pom + Tuscany DAS Distribution (Source) + Tuscany Distribution for DAS. + + + + org.apache.tuscany.das + tuscany-das-rdb + ${das.version} + + + + + install + tuscany-das-${das.version} + + + org.apache.maven.plugins + maven-assembly-plugin + 2.2-beta-3 + + + package + + single + + + + + + src/main/assembly/src.xml + + + + + + diff --git a/das-java/trunk/distribution/source/src/main/assembly/src.xml b/das-java/trunk/distribution/source/src/main/assembly/src.xml new file mode 100644 index 0000000000..593e1bccd2 --- /dev/null +++ b/das-java/trunk/distribution/source/src/main/assembly/src.xml @@ -0,0 +1,63 @@ + + + + + src + tuscany-das-${das.version}-src + + zip + tar.gz + + + + + BUILDING* + LICENSE* + NOTICE* + DISCLAIMER* + README* + RELEASE_NOTES* + pom.xml + + true + + + ../../ + + true + + keep + + **/*.* + + + **/ldap/** + **/target/** + **/dastest/** + **/.settings/** + **/**.mdl + **/derby.log + **/.project + **/.classpath + + 0644 + + + \ No newline at end of file diff --git a/das-java/trunk/plugin/pom.xml b/das-java/trunk/plugin/pom.xml new file mode 100644 index 0000000000..c64751d03d --- /dev/null +++ b/das-java/trunk/plugin/pom.xml @@ -0,0 +1,107 @@ + + + + + org.apache.tuscany.das + tuscany-das + 1.0-SNAPSHOT + + 4.0.0 + tuscany-das-plugin + maven-plugin + Tuscany DAS Maven Plugin + + + + org.apache.maven + maven-plugin-api + 2.0.4 + compile + + + org.apache.maven + maven-model + 2.0.4 + + + org.apache.maven + maven-project + 2.0.4 + compile + + + org.apache.maven + maven-plugin-descriptor + 2.0.4 + compile + + + + org.apache.derby + derby + 10.2.2.0 + + + + torque + torque-gen + 3.3-RC2 + + + + org.apache.tuscany.das + tuscany-das-tools + ${das.version} + compile + + + + + + plugin-test + + + + org.apache.tuscany.das + tuscany-das-plugin + ${das.version} + + + dbToxsd + generate-resources + + ${basedir}/target/schema.xml + ${basedir}/target/sdoModel.xsd + org.apache.derby.jdbc.EmbeddedDriver + jdbc:derby:${basedir}/../rdb/target/dastest + APP + + + generate + + + + + + + + + + \ No newline at end of file diff --git a/das-java/trunk/plugin/src/main/java/org/apache/tuscany/das/plugin/GeneratorMojo.java b/das-java/trunk/plugin/src/main/java/org/apache/tuscany/das/plugin/GeneratorMojo.java new file mode 100644 index 0000000000..3c0b671ec7 --- /dev/null +++ b/das-java/trunk/plugin/src/main/java/org/apache/tuscany/das/plugin/GeneratorMojo.java @@ -0,0 +1,111 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.plugin; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.tuscany.das.rdb.util.DBToXSDGenerator; +import org.apache.tuscany.das.rdb.util.ModelXSDGenOption; + +/** + * @goal generate + * @phase generate-resources + * @description Generate XSD Model files from DB Schema or db schema XML file + */ +public class GeneratorMojo extends AbstractMojo { + /** + * The file containing db schema in xml + * + * @parameter property="schemaFile" + */ + private String schemaFile; + + /** + * The file that will contain Static SDO Model XSD + * @parameter + */ + private String modelFile; + + /** + * Specifies the driverClass to use for connecting to database. + * + * @parameter + */ + private String driverClass; + + /** + * Specifies the databaseURL + * + * @parameter + */ + private String databaseURL; + + /** + * DB Schema name. + * + * @parameter + */ + private String schemaName; + + /** + * Optional user name. + * + * @parameter + */ + private String userName; + + /** + * Optional password. + * + * @parameter + */ + private String password; + + public void execute() throws MojoExecutionException { + //if driverClass, databaseURL and schemaName present, use it to connect to DB , + //if any from these 3 is absent, and schemaFile is present use it as input + ModelXSDGenOption mo = new ModelXSDGenOption(); + if (null != driverClass && null != databaseURL && null != schemaName && null != schemaFile) { + mo.setDriverClass(driverClass); + mo.setDatabaseURL(databaseURL); + mo.setSchemaName(schemaName); + mo.setUserName(userName); + mo.setPassword(password); + mo.setSchemaFile(schemaFile); + mo.setModelFile(modelFile); + + try { + DBToXSDGenerator.getModelFileFromDB(mo); + } catch(Exception e) { + throw new MojoExecutionException(e.getMessage()); + } + } else if(null != schemaFile) { + mo.setSchemaFile(schemaFile); + mo.setModelFile(modelFile); //if null, STDOUT + try { + DBToXSDGenerator.getModelFileFromSchemaFile(mo); + } catch(Exception e) { + throw new MojoExecutionException(e.getMessage()); + } + } else { + throw new MojoExecutionException("Provide DB Connection info or DB Schema XML file!"); + } + } +} \ No newline at end of file diff --git a/das-java/trunk/pom.xml b/das-java/trunk/pom.xml new file mode 100644 index 0000000000..56efdcd33a --- /dev/null +++ b/das-java/trunk/pom.xml @@ -0,0 +1,160 @@ + + + + 4.0.0 + + org.apache.tuscany + parent + 3-SNAPSHOT + + org.apache.tuscany.das + tuscany-das + 1.0-SNAPSHOT + pom + Apache Tuscany DAS Implementation project + + + scm:svn:http://svn.apache.org/repos/asf/tuscany/java/das + scm:svn:https://svn.apache.org/repos/asf/tuscany/java/das + http://svn.apache.org/repos/asf/tuscany/java/das/ + + + + 1.0-SNAPSHOT + 1.1.1 + + + + + + apache.snapshots + Apache Snapshot Repository + http://people.apache.org/repo/m2-snapshot-repository + + false + + + true + + + + apache.incubator + Apache Incubator Repository + http://people.apache.org/repo/m2-incubating-repository/ + + true + + + false + + + + + + + + org.apache.tuscany.sdo + tuscany-sdo-impl + ${sdo.version} + compile + + + + junit + junit + 3.8.1 + test + + + + + + install + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.4 + 1.4 + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*TestCase.java + + brief + false + + + + org.apache.maven.plugins + maven-jar-plugin + + + + ${project.artifactId} + ${name} + The Apache Software Foundation + ${version} + ${name} + org.apache + The Apache Software Foundation + ${version} + + + + 2.1 + + + + + + + default + + true + + + + rdb + samples + tools + plugin + + + + + distribution + + rdb + samples + tools + plugin + distribution/binary + distribution/source + + + + + diff --git a/das-java/trunk/rdb/pom.xml b/das-java/trunk/rdb/pom.xml new file mode 100644 index 0000000000..059a08c52b --- /dev/null +++ b/das-java/trunk/rdb/pom.xml @@ -0,0 +1,272 @@ + + + + 4.0.0 + + org.apache.tuscany.das + tuscany-das + 1.0-SNAPSHOT + + + tuscany-das-rdb + Tuscany DAS for Relational Databases + + + + org.apache.tuscany.sdo + tuscany-sdo-api-r2.1 + ${sdo.version} + + + + org.apache.tuscany.sdo + tuscany-sdo-impl + ${sdo.version} + + + + org.apache.tuscany.sdo + tuscany-sdo-lib + ${sdo.version} + + + + stax + stax-api + 1.0.1 + + + + org.apache.derby + derby + 10.2.2.0 + test + + + + log4j + log4j + 1.2.14 + compile + + + + junit + junit + 3.8.1 + test + + + + + install + + + + + + default + + true + + + + + + org.apache.tuscany.sdo + tuscany-sdo-plugin + ${sdo.version} + + + config + + ${basedir}/src/main/resources/config.xsd + true + true + + + generate + + + + companynoid + + ${basedir}/src/test/resources/companynoid.xsd + true + + + generate + + + + company + + ${basedir}/src/test/resources/company.xsd + true + + + generate + + + + customer + + ${basedir}/src/test/resources/customer.xsd + true + + + generate + + + + singer + + ${basedir}/src/test/resources/SINGER.xsd + true + + + generate + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*AllTestsDerby.java + + + + + + + + + + distribution + + + + + org.apache.tuscany.sdo + tuscany-sdo-plugin + ${sdo.version} + + + config + + ${basedir}/src/main/resources/config.xsd + true + true + + + generate + + + + companynoid + + ${basedir}/src/test/resources/companynoid.xsd + true + + + generate + + + + company + + ${basedir}/src/test/resources/company.xsd + true + + + generate + + + + customer + + ${basedir}/src/test/resources/customer.xsd + true + + + generate + + + + singer + + ${basedir}/src/test/resources/SINGER.xsd + true + + + generate + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*AllTestsDerby.java + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.2 + + 2.0 + true + 0 + false + + + + package + package + + jar + + + + + + + + + + + + + + + + diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/Command.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/Command.java new file mode 100644 index 0000000000..1e641b71e7 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/Command.java @@ -0,0 +1,138 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.IOException; +import java.io.OutputStream; +import java.util.List; + +import org.apache.tuscany.das.rdb.config.ResultDescriptor; + +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 + */ + void execute(); + + /** + * Performs the function defined by the command and return the results in the root DataObject + * + * @return the root DataObject + */ + DataObject executeQuery(); + + /** + * Sets the value of the associated Parameter + * + * @param index + * the index of the Parameter + * @param value + * the value for the Parameter + */ + 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 + */ + Object getParameter(int index); + + /** + * + * @param name Name of parameter - should match exact name of database table column + * as appearing in Command + * @param value + * the value of the parameter + */ + void setParameter(String name, Object value); + + /** + * + * @param name + * the name of the parameter - should match exact name of database table column + * @return the value of the parameter + */ + Object getParameter(String name); + + /** + * 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 + */ + int getGeneratedKey(); + + /** + * Allow set of ResultDescriptor when command is created on-the-fly + * @param resultDescriptorList + */ + void setResultDescriptors(List resultDescriptorList); + + List getResultDescriptors(); + + /** + * Add/replace based on columnIndex (>=0)embedded in resultDescriptor else add at end + * @param resultDescriptor + */ + void addResultDescriptor(ResultDescriptor resultDescriptor); + + /** + * remove ResultDescriptor at given columnIndex(>=0) and return same. If not + * present return null. For -ve index, return null + * @param columnIndex + * @return + */ + ResultDescriptor removeResultDescriptor(int columnIndex); + + /** + * Remove resultDescriptor only if matched for index(>=0), name, type, schema + * name and table name and return same, else return null For -ve index, ignore + * index and if unique match for rest of the attriutes, remove/return, if multiple + * matches found, throw RuntimeException + * @param resultDescriptor + * @return + */ + ResultDescriptor removeResultDescriptor(ResultDescriptor resultDescriptor); + + /** + * Return resultDescriptor if exact match for columnIndex(>=0) found + * else return null; + * + * @param columnIndex + * @return + */ + ResultDescriptor getResultDescriptor(int columnIndex); + + /** + * Utility method + * @param ostrm + * @throws IOException + */ + void printResultDescriptors(OutputStream ostrm) throws IOException; +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/ConfigHelper.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/ConfigHelper.java new file mode 100644 index 0000000000..d4582374e1 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/ConfigHelper.java @@ -0,0 +1,318 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.util.Vector; + +import org.apache.tuscany.das.rdb.config.Column; +import org.apache.tuscany.das.rdb.config.Command; +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.ConfigFactory; +import org.apache.tuscany.das.rdb.config.Parameters; +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.impl.ParametersExtendedImpl; +import org.apache.tuscany.das.rdb.util.ConfigUtil; + +/** + * 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 = ConfigFactory.INSTANCE; + + /** + * Default constructor + */ + public ConfigHelper() { + config = factory.createConfig(); + configWrapper = new MappingWrapper(config); + } + + /** + * Constructor that receives a Config stream + * This is usefull to extend a config file + * @param configStream The configuration stream + */ + public ConfigHelper(InputStream configStream) { + this.config = ConfigUtil.loadConfig(configStream); + configWrapper = new MappingWrapper(config); + } + + /** + * Constructor that receives a Config object + * @param config The configuration object + */ + public ConfigHelper(Config config) { + this.config = config; + configWrapper = new MappingWrapper(config); + } + + /** + * Add PK information + * @param columnName The column to be taken as PK + */ + public void addPrimaryKey(String columnName) { + configWrapper.addPrimaryKey(columnName); + } + + /** + * Add PK information, with different TypeName + * @param columnName + * @param typeName + */ + public void addPrimaryKey(String columnName, String propertyName) { + configWrapper.addPrimaryKey(columnName, propertyName); + } + + /** + * Add relationship information + * @param parentName + * @param childName + * @return + */ + public Relationship addRelationship(String parentName, String childName) { + return addRelationship(parentName, childName, null); + } + + /** + * Add relationship information + * @param parentName + * @param childName + * @param relationshipName + * @return + */ + public Relationship addRelationship(String parentName, String childName, String relationshipName) { + return configWrapper.addRelationship(parentName, childName, relationshipName); + } + + /** + * Add relationship information + * @param parentNames + * @param childNames + * @return + */ + public Relationship addRelationship(Vector parentNames, Vector childNames) { + return addRelationship(parentNames, childNames, null); + } + + /** + * Add relationship information + * @param parentNames + * @param childNames + * @param relationshipName + * @return + */ + public Relationship addRelationship(Vector parentNames, Vector childNames, String relationshipName) { + return configWrapper.addRelationship(parentNames, childNames, relationshipName); + } + + /** + * Add table information + * @param name + * @param typeName + * @return + */ + public Table addTable(String name, String typeName) { + return configWrapper.addTable(name, typeName); + } + + /** + * Add table information with schema information + * @param name + * @param schemaName + * @param typeName + * @return + */ + public Table addTable(String name, String schemaName, String typeName) { + return configWrapper.addTable(name, schemaName, typeName); + } + + /** + * Add column information + * @param table + * @param columnName + * @param propertyName + * @return + */ + public Column addColumn(Table table, String columnName, String propertyName) { + return configWrapper.addColumn(table, columnName, propertyName); + } + + /** + * Add an update statement for a given table + * @param table + * @param statement + * @param parameters String - names separated with space + */ + public void addUpdateStatement(Table table, String statement, String parameters) { + ParametersExtendedImpl parametersExtendedImpl = new ParametersExtendedImpl(); + parametersExtendedImpl.addParameters(ParametersExtendedImpl.getParameters(parameters)); + configWrapper.addUpdateStatement(table, statement, parametersExtendedImpl); + } + + /** + * Add an update statement for a given table + * @param table + * @param statement + * @param parameters + */ + public void addUpdateStatement(Table table, String statement, Parameters parameters) { + configWrapper.addUpdateStatement(table, statement, parameters); + } + + /** + * Add create statement for a given table + * @param table + * @param statement + * @param parameters String - names separated with space + */ + public void addCreateStatement(Table table, String statement, String parameters) { + ParametersExtendedImpl parametersExtendedImpl = new ParametersExtendedImpl(); + parametersExtendedImpl.addParameters(ParametersExtendedImpl.getParameters(parameters)); + configWrapper.addCreateStatement(table, statement, parametersExtendedImpl); + } + + /** + * Add create statement for a given table + * @param table + * @param statement + * @param parameters + */ + public void addCreateStatement(Table table, String statement, Parameters parameters) { + configWrapper.addCreateStatement(table, statement, parameters); + } + + /** + * Add delete statement for a given table + * @param table + * @param statement + * @param parameters String - names separated with space + */ + public void addDeleteStatement(Table table, String statement, String parameters) { + ParametersExtendedImpl parametersExtendedImpl = new ParametersExtendedImpl(); + parametersExtendedImpl.addParameters(ParametersExtendedImpl.getParameters(parameters)); + configWrapper.addDeleteStatement(table, statement, parametersExtendedImpl); + } + + /** + * Add delete statement for a given table + * @param table + * @param statement + * @param parameters + */ + public void addDeleteStatement(Table table, String statement, Parameters parameters) { + configWrapper.addDeleteStatement(table, statement, parameters); + } + + /** + * Add datasource connection information + * @param dataSourceName + */ + public void addConnectionInfo(String dataSourceName) { + configWrapper.addConnectionInfo(dataSourceName, true); + } + + /** + * Add datasource connection information and flag about using managed transactions + * @param dataSourceName + * @param managedtx + */ + public void addConnectionInfo(String dataSourceName, boolean managedtx) { + configWrapper.addConnectionInfo(dataSourceName, managedtx); + } + + /** + * Add driver manager connection information + * @param driverClass + * @param databaseURL + * @param user + * @param password + * @param loginTimeout + */ + public void addConnectionInfo(String driverClass, String databaseURL, String user, String password, int loginTimeout) { + configWrapper.addConnectionInfo(driverClass, databaseURL, user, password, loginTimeout); + } + + /** + * Set the data object model + * @param dataObjectModel + */ + public void setDataObjectModel(String dataObjectModel) { + configWrapper.getConfig().setDataObjectModel(dataObjectModel); + } + + /** + * Add a select command + * @param name + * @param sql + * @return + */ + public Command addSelectCommand(String name, String sql) { + return configWrapper.addCommand(name, sql, "select"); + } + + /** + * Add a update command + * @param name + * @param sql + * @return + */ + public Command addUpdateCommand(String name, String sql) { + return configWrapper.addCommand(name, sql, "update"); + } + + /** + * Add a insert command + * @param name + * @param sql + * @return + */ + public Command addInsertCommand(String name, String sql) { + return configWrapper.addCommand(name, sql, "insert"); + } + + /** + * Add a delete command + * @param name + * @param sql + * @return + */ + public Command addDeleteCommand(String name, String sql) { + return configWrapper.addCommand(name, sql, "delete"); + } + + /** + * Get a reference to the config object + * @return + */ + public Config getConfig() { + return config; + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/Converter.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/Converter.java new file mode 100644 index 0000000000..24f2e5ee2e --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/Converter.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 + */ + 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 + */ + Object getColumnValue(Object propertyData); + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/DAS.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/DAS.java new file mode 100644 index 0000000000..43f1e30d1a --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/DAS.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.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 { + + 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 + */ + 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 + */ + Command getCommand(String name); + + /** + * If the CommandGroup is managing connections then this method must be called + * when the client is done with the instance. + * + */ + void releaseResources(); + + /** + * Creates a Command based on the provided SQL statement + * + * @param sql + * The SQL statement + * @return returns a Command instance + */ + Command createCommand(String sql); + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/DASFactory.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/DASFactory.java new file mode 100644 index 0000000000..313fff225a --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/DASFactory.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 + */ + DAS createDAS(InputStream configStream); + + /** + * Creates a DAS based on the provide config file stream and connection + * @param configStream + * @param connection + * @return + */ + 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 + */ + DAS createDAS(Config config); + + /** + * Creates a DAS based on the provided config and connection + * @param config + * @param connection + * @return + */ + DAS createDAS(Config config, Connection connection); + + /** + * Creates a DAS based on the provided connection + * @param connection + * @return + */ + DAS createDAS(Connection connection); + + +} + diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/Pager.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/Pager.java new file mode 100644 index 0000000000..aa18558fce --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/Pager.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 + */ + DataObject next(); + + /** + * Get the page prior to the last page returned + * + * @return the previous page + */ + DataObject previous(); + + /** + * Return a specific identified page. + * + * @param page + * The number of the page to return + * @return the indicated page + */ + DataObject getPage(int page); + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/MappingWrapper.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/MappingWrapper.java new file mode 100644 index 0000000000..6c010b3ee8 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/MappingWrapper.java @@ -0,0 +1,945 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Vector; + +import org.apache.log4j.Logger; +import org.apache.tuscany.das.rdb.config.Column; +import org.apache.tuscany.das.rdb.config.Command; +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.ConfigFactory; +import org.apache.tuscany.das.rdb.config.ConnectionInfo; +import org.apache.tuscany.das.rdb.config.ConnectionProperties; +import org.apache.tuscany.das.rdb.config.Create; +import org.apache.tuscany.das.rdb.config.Delete; +import org.apache.tuscany.das.rdb.config.KeyPair; +import org.apache.tuscany.das.rdb.config.Parameters; +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 commonj.sdo.Property; + +public class MappingWrapper { + + private static final ConfigFactory FACTORY = ConfigFactory.INSTANCE; + + private final Logger logger = Logger.getLogger(MappingWrapper.class); + + private Config config; + + // TUSCANY-2288 + private List insertOrder; + private List deleteOrder; + private Set rootTableNames; + // -- + + + public MappingWrapper() { + config = FACTORY.createConfig(); + //JIRA-952 + this.checkSchemaNameSupport(); + } + + //JIRA-952 - check if there is any entry with no schemaName when support is ON + public void checkSchemaNameSupport(){ + if(config.isDatabaseSchemaNameSupported()){ + List tableList = config.getTable(); + for(int i=0; itype, if one is available in Config*/ + public Collection getRelationshipsByChildTable(String name) { + Table table = getTableByTypeName(name); + + if(table != null) { + if(config.isDatabaseSchemaNameSupported()) { + name = table.getSchemaName()+"."+table.getTableName(); + } else { + name = table.getTableName(); + } + } + //table can be null, when no in Config and Query based Dynamic Types are used during query + + List 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; + } + + public Set getRootTableNames() { + if (this.logger.isDebugEnabled()) { + this.logger.debug("Getting root tables"); + } + if (rootTableNames == null) { + rootTableNames = new HashSet(); + if (config == null) return rootTableNames; + // parse all relationships + Set allParents = new HashSet(); + Set allChildren = new HashSet(); + Iterator i = getConfig().getRelationship().iterator(); + while (i.hasNext()) { + Relationship r = (Relationship) i.next(); + String parent = r.getPrimaryKeyTable(); + String child = r.getForeignKeyTable(); + if (parent.equals(child)) { + // self-relationship + // do not add to all children list to allow root detection + allParents.add(parent); + } else { + allParents.add(parent); + allChildren.add(child); + } + } + // find roots (depth 0) + // roots are tables that are present in the parents set, but not in the children set + for (Iterator itParents = allParents.iterator(); itParents.hasNext(); ) { + String parent = (String) itParents.next(); + if (!allChildren.contains(parent)) { + rootTableNames.add(parent); + } + } + } + if (this.logger.isDebugEnabled()) { + this.logger.debug(rootTableNames); + } + return rootTableNames; + } + + // TUSCANY-2288 + public List getInsertOrder() { + if (this.logger.isDebugEnabled()) { + this.logger.debug("Getting insert order"); + } + if (insertOrder == null) { + insertOrder = new ArrayList(); + if (config == null) return insertOrder; + // correct insert order: tables sorted by ascending depth + // parse all relationships + Set allParents = new HashSet(); + Set allChildren = new HashSet(); + Map parentToChild = new HashMap(); + Iterator i = getConfig().getRelationship().iterator(); + while (i.hasNext()) { + Relationship r = (Relationship) i.next(); + String parent = r.getPrimaryKeyTable(); + String child = r.getForeignKeyTable(); + if (parent.equals(child)) { + // self-relationship + // do not add to parent to child map to avoid loops + // do not add to all children list to allow root detection + allParents.add(parent); + } else { + allParents.add(parent); + allChildren.add(child); + Set children = (Set) parentToChild.get(parent); + if (children == null) { + children = new HashSet(); + parentToChild.put(parent, children); + } + children.add(child); + } + } + // build list of tables ordered by depth + List depthList = new ArrayList(); + // find roots (depth 0) + // roots are tables that are present in the parents set, but not in the children set + Set roots = new HashSet(); + for (Iterator itParents = allParents.iterator(); itParents.hasNext(); ) { + String parent = (String) itParents.next(); + if (!allChildren.contains(parent)) { + roots.add(parent); + } + } + // traverse table graph to populate depth list + traverseTableGraph(roots, 0, parentToChild, depthList, new ArrayList()); + // build insert order from depth list + for (Iterator itDepths = depthList.iterator(); itDepths.hasNext(); ) { + Set tables = (Set) itDepths.next(); + insertOrder.addAll(tables); + } + } + if (this.logger.isDebugEnabled()) { + this.logger.debug(insertOrder); + } + return insertOrder; + } + + private void traverseTableGraph(Set parents, int parentDepth, Map parentToChild, List depthList, List branch) { + int childDepth = parentDepth + 1; + // expand depth list if necessary + for (int i = depthList.size() - 1; i < parentDepth; i++) { + Set tables = new HashSet(); + depthList.add(tables); + } + // loop thru parents + for (Iterator itParents = parents.iterator(); itParents.hasNext(); ) { + String parent = (String) itParents.next(); + if (branch.contains(parent)) { + // we found a cycle + // we don't handle cycles + // stop traversing branch to avoid infinite loop + break; + } + // add parent to depth list + addTableToDepthList(parent, parentDepth, depthList); + // make recursive call on children + Set children = (Set) parentToChild.get(parent); + if (children != null && children.size() > 0) { + List parentBranch = new ArrayList(); + parentBranch.addAll(branch); + parentBranch.add(parent); + traverseTableGraph(children, childDepth, parentToChild, depthList, parentBranch); + } + } + } + + private void addTableToDepthList(String table, int depth, List depthList) { + // in this method, keep in mind that the same table can appear multiple times at multiple depths inside the table graph + // check if table is already somewhere in depth list + int currentDepth = getTableDepth(table, depthList); + if (currentDepth == -1) { + // table not in depth list + // add it + Set tables = (Set) depthList.get(depth); + tables.add(table); + } else if (currentDepth < depth) { + // table already in depth list, at a lower depth + // the table should only be present once, at the greatest possible depth + // replace table at the new depth + Set tables = (Set) depthList.get(currentDepth); + tables.remove(table); + tables = (Set) depthList.get(depth); + tables.add(table); + } else { + // table already in depth list, at a greater or same depth + // nothing to do, since the table should only be present once, at the greatest possible depth + } + } + + private int getTableDepth(String table, List depthList) { + int depth = -1; + // loop thru depth list + int count = depthList.size(); + for (int i = 0; i < count; i++) { + Set tables = (Set) depthList.get(i); + if (tables != null && tables.contains(table)) { + depth = i; + break; + } + } + return depth; + } + + + public List getDeleteOrder() { + if (deleteOrder == null) { + deleteOrder = new ArrayList(); + deleteOrder.addAll(getInsertOrder()); + Collections.reverse(deleteOrder); + } + return deleteOrder; + } + + // -- + + + //JIRA-952 + public void addConverter(String name, String converter) { + QualifiedColumn column = new QualifiedColumn(name, this.config.isDatabaseSchemaNameSupported()); + Table t = null; + t = findOrCreateTable(column); + 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 Map getConverters(Table table) { + Map 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())) { + if (getTableTypeName(r.getPrimaryKeyTable()).equals(ref.getContainingType().getName())) return r; + } else if(ref.getOpposite().getName().equals(r.getName())) { + if (getTableTypeName(r.getForeignKeyTable()).equals(ref.getContainingType().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 addUpdateStatement(Table table, String statement, Parameters parameters) { + + Update update = ConfigFactory.INSTANCE.createUpdate(); + update.setSql(statement); + update.setParameters(parameters); + table.setUpdate(update); + + } + + public void addDeleteStatement(Table table, String statement, Parameters parameters) { + + Delete delete = ConfigFactory.INSTANCE.createDelete(); + delete.setSql(statement); + delete.setParameters(parameters); + table.setDelete(delete); + + } + + public void addCreateStatement(Table table, String statement, Parameters parameters) { + + Create create = ConfigFactory.INSTANCE.createCreate(); + create.setSql(statement); + create.setParameters(parameters); + table.setCreate(create); + + } + + //JIRA-948 support for driver manager connection + public void addConnectionInfo(String dataSourceName, boolean managedtx){ + ConnectionInfo info = ConfigFactory.INSTANCE.createConnectionInfo(); + info.setDataSource(dataSourceName); + info.setManagedtx(managedtx); + + config.setConnectionInfo(info); + } + + public void addConnectionInfo(String driverClass, String connectionURL, String user, String password, int loginTimeout) { + ConnectionInfo info = ConfigFactory.INSTANCE.createConnectionInfo(); + + ConnectionProperties connectionProperties = ConfigFactory.INSTANCE.createConnectionProperties(); + connectionProperties.setDriverClass(driverClass); + connectionProperties.setDatabaseURL(connectionURL); + connectionProperties.setUserName(user); + connectionProperties.setPassword(password); + connectionProperties.setLoginTimeout(loginTimeout); + + info.setConnectionProperties(connectionProperties); + config.setConnectionInfo(info); + } + //JIRA-948 end + + public Command addCommand(String name, String sql, String kind) { + Command cmd = ConfigFactory.INSTANCE.createCommand(); + cmd.setName(name); + cmd.setKind(kind); + cmd.setSQL(sql); + + config.getCommand().add(cmd); + + return cmd; + } + + //JIRA-952 + public void addImpliedPrimaryKey(String schemaName, String tableName, String columnName) { + Table t = findOrCreateTable(schemaName, tableName);//JIRA-952 + + Iterator i = t.getColumn().iterator(); + boolean hasPK = false; + while (i.hasNext()) { + Column c = (Column) i.next(); + if (c.isPrimaryKey()) { + hasPK = true; + } + } + + if (!hasPK) { + Column c = findOrCreateColumn(t, columnName); + c.setPrimaryKey(true); + } + + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/QualifiedColumn.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/QualifiedColumn.java new file mode 100644 index 0000000000..95e5e78c54 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/QualifiedColumn.java @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.log4j.Logger; + +public class QualifiedColumn { + + private final String tableName; + + private final String columnName; + private final String schemaName;//JIRA-952 + + private final Logger logger = Logger.getLogger(QualifiedColumn.class); + + public QualifiedColumn(String name) { + this.schemaName = ""; + int index = name.indexOf('.'); + if ( index == -1 ) { + throw new RuntimeException("Column " + name + " must be qualified with a table name"); + } + tableName = name.substring(0, index); + columnName = name.substring(index + 1); + + if (this.logger.isDebugEnabled()) { + this.logger.debug("Table name: " + tableName); + this.logger.debug("Column name: " + columnName); + } + } + + //JIRA-952 + public QualifiedColumn(String name, boolean isDatabaseSchemaNameSupported) { + int index = name.indexOf('.'); + if ( index == -1 ) { + throw new RuntimeException("Column " + name + " must be qualified with a table name and optional schema name"); + } + + int lastIndex = name.lastIndexOf('.'); + + if(index == lastIndex && isDatabaseSchemaNameSupported){ + throw new RuntimeException("Column " + name + " must be qualified with a table name and schema name"); + } + + if(isDatabaseSchemaNameSupported){ + schemaName = name.substring(0, index); + tableName = name.substring(index+1, lastIndex); + columnName = name.substring(lastIndex + 1); + } + else{ + schemaName = ""; + tableName = name.substring(0, index); + columnName = name.substring(index + 1); + } + + if (this.logger.isDebugEnabled()) { + this.logger.debug("Table name: " + tableName); + this.logger.debug("Column name: " + columnName); + } + } + public String getTableName() { + return this.tableName; + } + + //JIRA-952 + public String getSchemaName() { + return this.schemaName; + } + public String getColumnName() { + return this.columnName; + } + //JIRA-952 + public String toString(){ + if(this.schemaName == null || this.schemaName.equals("")) + return this.tableName+"."+this.columnName; + else + return this.schemaName+"."+this.tableName+"."+this.columnName; + } +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/RelationshipWrapper.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/RelationshipWrapper.java new file mode 100644 index 0000000000..af2ab7ca5b --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/RelationshipWrapper.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 java.util.List; + +import org.apache.tuscany.das.rdb.config.KeyPair; +import org.apache.tuscany.das.rdb.config.Relationship; + +public class RelationshipWrapper { + + private Relationship relationship; + private List foreignKeys; + + public RelationshipWrapper(Relationship r) { + this.relationship = r; + } + + public Collection getForeignKeys() { + if (foreignKeys == null) { + foreignKeys = new ArrayList(); + Iterator i = this.relationship.getKeyPair().iterator(); + while (i.hasNext()) { + KeyPair pair = (KeyPair) i.next(); + foreignKeys.add(pair.getForeignKeyColumn()); + } + } + return foreignKeys; + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/TableWrapper.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/TableWrapper.java new file mode 100644 index 0000000000..ef420eedf2 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/TableWrapper.java @@ -0,0 +1,149 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 java.util.List; + +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 String getTableName() { + return table.getTableName(); + } + + public Collection getPrimaryKeyNames() { + List 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() { + + List 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(); + } + + 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(); + } + return c.getColumnName(); + + } + + public String getManagedColumnPropertyName() { + Iterator i = table.getColumn().iterator(); + while (i.hasNext()) { + Column c = (Column) i.next(); + if (c.isCollision() && c.isManaged()) { + return c.getPropertyName() == null ? c.getColumnName() : c.getPropertyName(); + } + } + return null; + + } + + public Column getManagedColumn() { + Iterator i = table.getColumn().iterator(); + while (i.hasNext()) { + Column c = (Column) i.next(); + if (c.isCollision() && c.isManaged()) { + return c; + } + } + return null; + } +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/exception/DataSourceInitializationException.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/exception/DataSourceInitializationException.java new file mode 100644 index 0000000000..6a644b7ed9 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/exception/DataSourceInitializationException.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.exception; + +public class DataSourceInitializationException extends RuntimeException { + + private static final long serialVersionUID = 302160989411041041L; + + public DataSourceInitializationException(String string) { + super(string); + } + + public DataSourceInitializationException(Throwable e){ + super(e); + } + + public DataSourceInitializationException(String string, Throwable e) { + super(string, e); + } +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/exception/OptimisticConcurrencyException.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/exception/OptimisticConcurrencyException.java new file mode 100644 index 0000000000..dc64d7dc94 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/exception/OptimisticConcurrencyException.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.exception; + + +public class OptimisticConcurrencyException extends RuntimeException { + + private static final long serialVersionUID = -8430445422807942933L; + + public OptimisticConcurrencyException(String string) { + super(string); + } + + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/BaseGenerator.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/BaseGenerator.java new file mode 100644 index 0000000000..05d97723a7 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/BaseGenerator.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 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/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/DeleteGenerator.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/DeleteGenerator.java new file mode 100644 index 0000000000..ad2a90c841 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/DeleteGenerator.java @@ -0,0 +1,91 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.log4j.Logger; +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.DeleteCommandImpl; +import org.apache.tuscany.das.rdb.impl.ParameterExtendedImpl; +import org.apache.tuscany.das.rdb.impl.SDODataTypeHelper; +import org.apache.tuscany.das.rdb.impl.SDODataTypes; + +public final class DeleteGenerator extends BaseGenerator { + + public static final DeleteGenerator INSTANCE = new DeleteGenerator(); + + private final Logger logger = Logger.getLogger(DeleteGenerator.class); + + private DeleteGenerator() { + super(); + } + + //JIRA-952 + private String getDeleteStatement(MappingWrapper mapping, Table t) { + TableWrapper table = new TableWrapper(t); + + StringBuffer statement = new StringBuffer(); + statement.append("delete from "); + if(mapping.getConfig().isDatabaseSchemaNameSupported()){ + statement.append(t.getSchemaName()+"."+t.getTableName()); + } + else{ + 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 "); + } + } + + if (this.logger.isDebugEnabled()) { + this.logger.debug(statement.toString()); + } + + return statement.toString(); + } + + public DeleteCommandImpl getDeleteCommand(MappingWrapper mapping, Table t) { + TableWrapper tw = new TableWrapper(t); + DeleteCommandImpl deleteCommand = new DeleteCommandImpl(getDeleteStatement(mapping, t)); + + Iterator i = tw.getPrimaryKeyProperties().iterator(); + for (int idx = 1; i.hasNext(); idx++) { + String property = (String) i.next(); + ParameterExtendedImpl p = new ParameterExtendedImpl(); + p.setName(property); + p.setColumnType(SDODataTypeHelper.columnTypeForSDOType(SDODataTypes.OBJECT)); + p.setConverter(getConverter(tw.getConverter(property))); + p.setIndex(idx); + deleteCommand.addParameter(p); + } + return deleteCommand; + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/InsertGenerator.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/InsertGenerator.java new file mode 100644 index 0000000000..d174629ad9 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/InsertGenerator.java @@ -0,0 +1,182 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.HashSet; +import java.util.Iterator; +import java.util.List; + +import org.apache.log4j.Logger; +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.impl.InsertCommandImpl; +import org.apache.tuscany.das.rdb.impl.ParameterExtendedImpl; +import org.apache.tuscany.das.rdb.impl.SDODataTypeHelper; +import org.apache.tuscany.das.rdb.util.CollectionsUtil; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; + +public final class InsertGenerator extends BaseGenerator { + + public static final InsertGenerator INSTANCE = new InsertGenerator(); + + private final Logger logger = Logger.getLogger(InsertGenerator.class); + + private InsertGenerator() { + super(); + } + + public InsertCommandImpl getInsertCommand(MappingWrapper config, DataObject changedObject, Table t) { + List parameters = new ArrayList(); + TableWrapper table = new TableWrapper(t); + StringBuffer statement = new StringBuffer("insert into "); + //JIRA-952 + if(config.getConfig().isDatabaseSchemaNameSupported()){ + statement.append(t.getSchemaName()+"."+t.getTableName()); + } + else{ + statement.append(t.getTableName()); + } + HashSet changedProperties = getAttributeProperties(changedObject, config, table); + Iterator i; + if ( changedProperties.isEmpty() ) { + i = changedObject.getType().getProperties().iterator(); + } else { + i = changedProperties.iterator(); + } + + List attributes = new ArrayList(); + List generatedKeys = new ArrayList(); + while (i.hasNext()) { + Property attr = (Property) i.next(); + if ( attr.getType().isDataType()) { + if (table.isGeneratedColumnProperty(attr.getName())) { + generatedKeys.add(attr.getName()); + } else { + 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(""); + Column c = config.getColumnByPropertyName(t, name); + statement.append(c == null ? name : c.getColumnName()); + 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(), + (String[]) generatedKeys.toArray(new String[0])); + Iterator params = parameters.iterator(); + for (int idx = 1; params.hasNext(); idx++) { + Property property = (Property) params.next(); + ParameterExtendedImpl p = new ParameterExtendedImpl(); + p.setName(property.getName()); + p.setType(property.getType()); + p.setColumnType(SDODataTypeHelper.columnTypeForSDOType(property.getType())); + p.setConverter(getConverter(table.getConverter(property.getName()))); + p.setIndex(idx); + cmd.addParameter(p); + + } + if (this.logger.isDebugEnabled()) { + this.logger.debug(statement.toString()); + } + + return cmd; + + } + + private HashSet getAttributeProperties(DataObject obj, MappingWrapper config, TableWrapper tw) { + HashSet fields = new HashSet(); + Iterator i = obj.getType().getProperties().iterator(); + while (i.hasNext()) { + Property p = (Property) i.next(); + if (p.getType().isDataType()) { + if (obj.isSet(p)) { + if (fields.add(p) == false) { + throw new RuntimeException("Foreign key properties should not be set when the corrsponding relationship has changed"); + } + } + } else { + if (obj.isSet(p)) { + Relationship relationship = config.getRelationshipByReference(p); + if ((p.getOpposite() != null && p.getOpposite().isMany()) + || (hasState(tw, relationship, obj))) { + RelationshipWrapper r = new RelationshipWrapper(relationship); + Iterator keys = r.getForeignKeys().iterator(); + while (keys.hasNext()) { + String key = (String) keys.next(); + String keyProperty = config.getColumnPropertyName(tw.getTableName(), key); + Property keyProp = obj.getType().getProperty(keyProperty); + if ( keyProp == null ) + throw new RuntimeException("Invalid foreign key column: " + key); + if (fields.add(keyProp) == false) { + throw new RuntimeException("Foreign key properties should not be set when the corresponding relationship has changed"); + } + } + } + + } + } + } + + return fields; + + } + + private boolean hasState(TableWrapper tw, Relationship rel, DataObject changedObject) { + + if (!rel.isMany()) { + + RelationshipWrapper rw = new RelationshipWrapper(rel); + if ((rel.getForeignKeyTable().equals(tw.getTableName())) + && (CollectionsUtil.disjoint(tw.getPrimaryKeyProperties(), rw.getForeignKeys()))) { + return true; + } + } + + return false; + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/UpdateGenerator.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/UpdateGenerator.java new file mode 100644 index 0000000000..d74d3f413f --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/UpdateGenerator.java @@ -0,0 +1,271 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.HashSet; +import java.util.Iterator; +import java.util.List; + +import org.apache.log4j.Logger; +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.impl.CollisionParameter; +import org.apache.tuscany.das.rdb.impl.ManagedParameterImpl; +import org.apache.tuscany.das.rdb.impl.OptimisticWriteCommandImpl; +import org.apache.tuscany.das.rdb.impl.ParameterExtendedImpl; +import org.apache.tuscany.das.rdb.impl.SDODataTypeHelper; +import org.apache.tuscany.das.rdb.impl.UpdateCommandImpl; +import org.apache.tuscany.das.rdb.util.CollectionsUtil; + +import commonj.sdo.ChangeSummary; +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; +import commonj.sdo.ChangeSummary.Setting; + +public final class UpdateGenerator extends BaseGenerator { + + public static final UpdateGenerator INSTANCE = new UpdateGenerator(); + + private final Logger logger = Logger.getLogger(UpdateGenerator.class); + + private UpdateGenerator() { + super(); + } + + /*Utility to check if the given HashSet of Properties contains a property with certain name*/ + private boolean isContained(HashSet changedFields, String propertyName) { + Iterator itr = changedFields.iterator(); + while(itr.hasNext()) { + Property changedProperty = (Property)itr.next(); + if(changedProperty.getName().equals(propertyName)) { + return true; + } + } + return false; + } + + public UpdateCommandImpl getUpdateCommand(MappingWrapper mapping, DataObject changedObject, Table table) { + List parameters = new ArrayList(); + Type type = changedObject.getType(); + TableWrapper tableWrapper = new TableWrapper(table); + // get changed fields + ChangeSummary summary = changedObject.getDataGraph().getChangeSummary(); + HashSet changedFields = getChangedFields(mapping, summary, changedObject, tableWrapper); + // if there are no changed fields return null + if (changedFields.size() == 0) { + return null; + } + // compose statement + StringBuffer statement = new StringBuffer("update "); + if(mapping.getConfig().isDatabaseSchemaNameSupported()){ + statement.append(table.getSchemaName()+"."+table.getTableName()); + } + else{ + statement.append(table.getTableName()); + } + statement.append(" set "); + + Iterator i = changedFields.iterator(); + + int idx = 1; + while (i.hasNext()) { + Property property = (Property) i.next(); + Column c = tableWrapper.getColumnByPropertyName(property.getName()); + + if ((c == null) || !c.isCollision() || !c.isPrimaryKey()) { + String columnName = c == null ? property.getName() : c.getColumnName(); + appendFieldSet(statement, idx > 1, columnName); + parameters.add(createParameter(tableWrapper, property, idx++)); + } + } + + Column c = tableWrapper.getManagedColumn(); + if (c != null) { + appendFieldSet(statement, idx > 1, c.getColumnName()); + String propertyName = c.getPropertyName() == null ? c.getColumnName() : c.getPropertyName(); + parameters.add(createManagedParameter(tableWrapper, + changedObject.getInstanceProperty(propertyName), idx++)); + } + + statement.append(" where "); + + Iterator pkColumnNames = tableWrapper.getPrimaryKeyNames().iterator(); + Iterator pkPropertyNames = tableWrapper.getPrimaryKeyProperties().iterator(); + while (pkColumnNames.hasNext() && pkPropertyNames.hasNext()) { + String columnName = (String) pkColumnNames.next(); + String propertyName = (String) pkPropertyNames.next(); + + if(!isContained(changedFields, propertyName)) {//if PK itself is changed, don't add here, will get added below as collision parameter + statement.append(columnName); + statement.append(" = ?"); + if (pkColumnNames.hasNext() && pkPropertyNames.hasNext()) { + statement.append(" and "); + } + parameters.add(createParameter(tableWrapper, type.getProperty(propertyName), idx++)); + } + } + + if (tableWrapper.getCollisionColumn() == null) { + Iterator iter = changedFields.iterator(); + while (iter.hasNext()) { + if(statement.lastIndexOf(" where ") != statement.length()-7) + statement.append(" and "); + + Property changedProperty = (Property) iter.next(); + Column column = tableWrapper.getColumnByPropertyName(changedProperty.getName()); + statement.append(column == null ? changedProperty.getName() : column.getColumnName()); + + Object value; + Setting setting = summary.getOldValue(changedObject, changedProperty); + // Setting is null if this is a relationship change + if (setting == null) { + value = changedObject.get(changedProperty); + } else { + value = setting.getValue(); + } + + if (value == null) { + statement.append(" is null"); + } else { + ParameterExtendedImpl param = createCollisionParameter(tableWrapper, changedProperty, idx++); + statement.append(" = ?"); + param.setValue(value); + parameters.add(param); + } + + + } + + } else { + if(statement.lastIndexOf(" where ") != statement.length()-7) + statement.append(" and "); + + statement.append(tableWrapper.getCollisionColumn().getColumnName()); + statement.append(" = ?"); + parameters.add(createParameter(tableWrapper, + type.getProperty(tableWrapper.getCollisionColumnPropertyName()), idx++)); + } + + UpdateCommandImpl updateCommand = new OptimisticWriteCommandImpl(statement.toString()); + + Iterator params = parameters.iterator(); + while (params.hasNext()) { + ParameterExtendedImpl ptemp = (ParameterExtendedImpl) params.next(); + updateCommand.addParameter(ptemp); + } + + if (this.logger.isDebugEnabled()) { + this.logger.debug(statement.toString()); + } + + return updateCommand; + } + + + + private void appendFieldSet(StringBuffer statement, boolean appendComma, String columnName) { + if (appendComma) { + statement.append(", "); + } + statement.append(columnName); + statement.append(" = ?"); + } + + + + private HashSet getChangedFields(MappingWrapper config, ChangeSummary summary, DataObject obj, TableWrapper tw) { + HashSet changes = new HashSet(); + + Iterator i = summary.getOldValues(obj).iterator(); + while (i.hasNext()) { + ChangeSummary.Setting setting = (ChangeSummary.Setting) i.next(); + + if (setting.getProperty().getType().isDataType()) { + if ( changes.add(setting.getProperty()) == false ) { + throw new RuntimeException("Foreign key properties should not be set when the corresponding relationship has changed"); + } + } else { + Property ref = setting.getProperty(); + + Relationship relationship = config.getRelationshipByReference(ref); + if ((ref.getOpposite() != null && ref.getOpposite().isMany()) + || (hasState(tw, relationship, obj))) { + RelationshipWrapper r = new RelationshipWrapper(config.getRelationshipByReference(ref)); + + Iterator keys = r.getForeignKeys().iterator(); + while (keys.hasNext()) { + String key = (String) keys.next(); + String keyProperty = config.getColumnPropertyName(tw.getTableName(), key); + Property keyProp = obj.getType().getProperty(keyProperty); + if ( keyProp == null ) { + throw new RuntimeException("Invalid foreign key column: " + key); + } + if (changes.add(keyProp) == false) { + throw new RuntimeException("Foreign key properties should not be set when the corresponding relationship has changed"); + } + } + } + } + } + return changes; + } + + private boolean hasState(TableWrapper tw, Relationship rel, DataObject changedObject) { + if (!rel.isMany()) { + RelationshipWrapper rw = new RelationshipWrapper(rel); + if ((rel.getForeignKeyTable().equals(tw.getTableName())) + && (CollectionsUtil.disjoint(tw.getPrimaryKeyProperties(), rw.getForeignKeys()))) { + return true; + } + } + + return false; + } + + private ParameterExtendedImpl fillExtendedParameter(ParameterExtendedImpl param, TableWrapper table, Property property, int idx) { + param.setName(property.getName()); + param.setType(property.getType()); + param.setConverter(getConverter(table.getConverter(property.getName()))); + if (idx != -1) { + param.setIndex(idx); + } + param.setColumnType(SDODataTypeHelper.columnTypeForSDOType(property.getType())); + return param; + } + private ParameterExtendedImpl createCollisionParameter(TableWrapper tableWrapper, Property property, int i) { + ParameterExtendedImpl param = new CollisionParameter(); + return fillExtendedParameter(param, tableWrapper, property, i); + } + + private ParameterExtendedImpl createManagedParameter(TableWrapper table, Property property, int idx) { + ParameterExtendedImpl param = new ManagedParameterImpl(); + return fillExtendedParameter(param, table, property, idx); + } + + private ParameterExtendedImpl createParameter(TableWrapper table, Property property, int idx) { + ParameterExtendedImpl param = new ParameterExtendedImpl(); + return fillExtendedParameter(param, table, property, idx); + } +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java new file mode 100644 index 0000000000..0e5fc48c0c --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java @@ -0,0 +1,123 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.apache.log4j.Logger; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; +import commonj.sdo.helper.DataFactory; + +public final class DataObjectMaker { + + private final DataObject rootObject; + private final Map containmentPropertyMap; + private final Map typeMap; + + private static final Logger logger = Logger.getLogger(DataObjectMaker.class); + + public DataObjectMaker(DataObject root) { + this.rootObject = root; + containmentPropertyMap = new HashMap(); + typeMap = new HashMap(); + Iterator i = this.rootObject.getType().getProperties().iterator(); + while (i.hasNext()) { + Property p = (Property) i.next(); + Type type = p.getType(); + String typeName = type.getName(); + typeMap.put(typeName, type); + if (p.isContainment()) { + containmentPropertyMap.put(typeName, p); + } + } + } + + /** + * @param tableData + * @return + */ + public DataObject createAndAddDataObject(TableData tableData, ResultMetadata resultMetadata) { + // Get a Type from the package and create a standalone DataObject + + if (this.logger.isDebugEnabled()) { + this.logger.debug("Looking for Type for " + tableData.getTableName()); + } + + String tableName = tableData.getTableName(); + Type tableClass = (Type) typeMap.get(tableName); + + 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 + Property containmentProp = (Property) containmentPropertyMap.get(tableName); + if (containmentProp != null) { + if (containmentProp.isMany()) { + rootObject.getList(containmentProp).add(obj); + } else { + this.rootObject.set(containmentProp, obj); + } + } + + // Set the column values + Iterator columnNames = resultMetadata.getPropertyNames(tableData.getTableName()).iterator(); + Type objType = obj.getType(); + while (columnNames.hasNext()) { + String propertyName = (String) columnNames.next(); + Property p = objType.getProperty(propertyName); + if (p == null) { + // Try again, ignoring case + p = findProperty(objType, propertyName); + if (p == null) { + throw new RuntimeException("Type " + obj.getType().getName() + + " does not contain a property named " + propertyName); + } + } + + Object value = tableData.getColumnData(propertyName); + + 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; + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DefaultConverter.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DefaultConverter.java new file mode 100644 index 0000000000..a08f184b9a --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DefaultConverter.java @@ -0,0 +1,84 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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); + } + } + + return data; + + } +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/GraphBuilderMetadata.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/GraphBuilderMetadata.java new file mode 100644 index 0000000000..5be56d77d8 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/GraphBuilderMetadata.java @@ -0,0 +1,283 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.Relationship; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.impl.ResultSetShape; +import org.apache.tuscany.sdo.api.SDOUtil; + +import commonj.sdo.Property; +import commonj.sdo.Type; +import commonj.sdo.helper.HelperContext; +import commonj.sdo.impl.HelperProvider; + +/** + */ +public final class GraphBuilderMetadata { + + private static final Logger logger = Logger.getLogger(GraphBuilderMetadata.class); + + private MappingWrapper configWrapper; + + private final Collection resultSets = new ArrayList(); + + private String typeURI; + + private List definedTypes; + + private Type rootType; + + private HelperContext defaultHelperContext = HelperProvider.getDefaultContext(); + private HelperContext helperContext = HelperProvider.getInstance().getDefaultContext(); + + + public GraphBuilderMetadata(List results, Config model, ResultSetShape shape) throws SQLException { + this.configWrapper = new MappingWrapper(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, configWrapper, shape); + resultSets.add(resultMetadata); + } + + } + + /** + * Returns the collection of ResultMetadata objects + */ + public Collection getResultMetadata() { + return this.resultSets; + } + + /** + * Returns the set of defined relationships + */ + + public Collection getRelationships() { + return configWrapper.getConfig().getRelationship(); + } + + /** + * Returns the root Type + */ + public Type getRootType() { + if (this.rootType == null) { + if (this.typeURI == null) { + createDynamicTypes(); + } else { + createDynamicRoot(); + } + } + + return this.rootType; + } + + public MappingWrapper getConfigWrapper() { + return this.configWrapper; + } + + /** + * Creates a set of SDO Types based on the query results and supplied config information + */ + + private void createDynamicTypes() { + + Type root = SDOUtil.createType(helperContext, getDefaultURI(), "DataGraphRoot", false); + if (this.logger.isDebugEnabled()) { + this.logger.debug("GBMD.createDynamicTypes():created Type for "+getDefaultURI()); + } + + Iterator iter = 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(); + if (root.getProperty(tableName) == null) { + Type tableType = SDOUtil.createType(helperContext, getDefaultURI(), tableName, false); + Property property = SDOUtil.createProperty(root, tableName, tableType); + SDOUtil.setMany(property, true); + SDOUtil.setContainment(property, true); + if (this.logger.isDebugEnabled()) { + this.logger.debug("GBMD.createDynamicTypes():CREATING NEW TABLE TYPE & PROPERTY :"+tableName); + } + } + } + + // TODO tablePropertyMap is temporary until Tuscany-203 is fixed + Map tablePropertyMap = new HashMap(); + + for (int i = 1; i <= resultMetadata.getResultSetSize(); i++) { + + Property ref = root.getProperty(resultMetadata.getTablePropertyName(i)); + + if (ref == null) { + throw new RuntimeException("Could not find table " + resultMetadata.getTablePropertyName(i) + + " in the SDO model"); + } + + // TODO Temporary code to check to see if a property has already been added. + // Replace when Tuscany-203 is fixed + List addedProperties = (List) tablePropertyMap.get(ref.getName()); + if (addedProperties == null) { + addedProperties = new ArrayList(); + tablePropertyMap.put(ref.getName(), addedProperties); + } + + + + 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); + + } + + } + } + + MappingWrapper wrapper = getConfigWrapper(); + Iterator i = 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 = root.getProperty(parentName); + Property childProperty = root.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()); + } + + this.rootType = root; + } + + private String getDefaultURI() { + return "http:///org.apache.tuscany.das.rdb/das"; + } + + /** + * Create a dynamic root Type to act as a container Type for a set of generated Types + * + */ + private void createDynamicRoot() { + Type root = SDOUtil.createType(helperContext, getDefaultURI() + "/DataGraphRoot", "DataGraphRoot", false); + + List types = getDefinedTypes(); + + if (types == null) { + throw new RuntimeException("SDO Types have not been registered for URI " + typeURI); + } + + Iterator i = types.iterator(); + while (i.hasNext()) { + Type type = (Type) i.next(); + Property property = SDOUtil.createProperty(root, type.getName(), type); + SDOUtil.setContainment(property, true); + SDOUtil.setMany(property, true); + } + this.rootType = root; + } + + public List getDefinedTypes() { + if (this.definedTypes == null) { + List types = null; + List defaultTypes = null; + if (this.typeURI == null) { + types = SDOUtil.getTypes(helperContext, getDefaultURI()); + defaultTypes = SDOUtil.getTypes(defaultHelperContext, getDefaultURI()); + if(defaultTypes != null){ + if(types == null) { + types = defaultTypes; + } + else { + types.addAll(defaultTypes); + } + } + this.definedTypes = types; + } else { + types = SDOUtil.getTypes(helperContext, typeURI); + defaultTypes = SDOUtil.getTypes(defaultHelperContext, typeURI); + if(defaultTypes != null){ + if(types == null) { + types = defaultTypes; + } + else { + types.addAll(defaultTypes); + } + } + + if(rootType != null) + types.add(rootType); + this.definedTypes = types; + } + } + return this.definedTypes; + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/MultiTableRegistry.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/MultiTableRegistry.java new file mode 100644 index 0000000000..bc3ca440b9 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/MultiTableRegistry.java @@ -0,0 +1,116 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 java.util.Map; + +import org.apache.log4j.Logger; + +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 static final Logger logger = Logger.getLogger(MultiTableRegistry.class); + + private Map tableNameMap; + + private Map tableValueMap; + + 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 (this.logger.isDebugEnabled()) { + this.logger.debug("Looking for table " + tableName + " with PK " + primaryKey); + this.logger.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 Map getPkMap(String tableName) { + Map 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; + + } + + public void remove(String tableName, List primaryKey) { + getPkMap(tableName).get(primaryKey); + Map pkMap = (HashMap) tableNameMap.get(tableName); + + if(pkMap.get(primaryKey) != null) { + pkMap.remove(primaryKey); + } + + if(pkMap.size() == 0) { + tableNameMap.remove(tableName); + } + } +} \ No newline at end of file diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java new file mode 100644 index 0000000000..39f35150ec --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java @@ -0,0 +1,411 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +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.impl.SDODataTypes; + +import commonj.sdo.Type; + +public final class ResultMetadata { + + private Map tableToPropertyMap = new HashMap(); + + private List typeNames = new ArrayList(); + + private List propertyNames = new ArrayList(); + + private final ResultSet resultSet; + + private final ResultSetShape resultSetShape; + + private final MappingWrapper configWrapper; + + private Converter[] converters; + + private Map tableToPrimaryKeysMap = new HashMap(); + + //JIRA-952 + public ResultMetadata(ResultSet rs, MappingWrapper cfgWrapper, ResultSetShape shape) throws SQLException { + + this.resultSet = rs; + this.configWrapper = cfgWrapper; + + if (shape == null) { + this.resultSetShape = new ResultSetShape(rs.getMetaData(), configWrapper.getConfig()); + } else { + this.resultSetShape = shape; + } + + this.converters = new Converter[resultSetShape.getColumnCount()]; + + Map impliedRelationships = new HashMap(); + String schemaName = ""; + String idSpell = null; + for (int i = 1; i <= resultSetShape.getColumnCount(); i++) { + String tableName = resultSetShape.getTableName(i); + schemaName = resultSetShape.getSchemaName(i); + if (( tableName == null ) || ( tableName.equals(""))) { + throw new RuntimeException("Unable to obtain table information from JDBC. DAS configuration must specify ResultDescriptors"); + } + String typeName = null; + + if(this.configWrapper.getConfig().isDatabaseSchemaNameSupported()){ + typeName = configWrapper.getTableTypeName(schemaName+"."+tableName); + } + else{ + typeName = configWrapper.getTableTypeName(tableName); + } + String columnName = resultSetShape.getColumnName(i); + + String colName = ""; + if (columnName.regionMatches(true, columnName.length()-3, "_ID", 0, 3)) { + idSpell = columnName.substring(columnName.length()-3, columnName.length()); + if(this.configWrapper.getConfig().isDatabaseSchemaNameSupported()){ + colName = schemaName+"."+columnName; + impliedRelationships.put(colName, schemaName+"."+tableName); + } + else{ + colName = columnName; + impliedRelationships.put(colName, tableName); + } + } else if (columnName.equalsIgnoreCase("ID")) { + configWrapper.addImpliedPrimaryKey(schemaName, tableName, columnName); + } + + String propertyName = null; + + if(this.configWrapper.getConfig().isDatabaseSchemaNameSupported()){ + propertyName = configWrapper.getColumnPropertyName(schemaName+"."+tableName, columnName); + } + else{ + propertyName = configWrapper.getColumnPropertyName(tableName, columnName); + } + String converterName = null; + + if(this.configWrapper.getConfig().isDatabaseSchemaNameSupported()){ + converterName = configWrapper.getConverter(schemaName+"."+tableName, resultSetShape.getColumnName(i)); + } + else{ + converterName = configWrapper.getConverter(tableName, resultSetShape.getColumnName(i)); + } + + converters[i - 1] = loadConverter(converterName, resultSetShape.getColumnType(i)); + + typeNames.add(typeName); + propertyNames.add(propertyName); + + Collection properties = (Collection) tableToPropertyMap.get(typeName); + if (properties == null) { + properties = new ArrayList(); + } + properties.add(propertyName); + tableToPropertyMap.put(typeName, properties); + + } + + //System.out.println("tableToPropertyMap "+tableToPropertyMap); + fillTableToPrimaryKeysMap(); + + Iterator i = impliedRelationships.keySet().iterator(); + while (i.hasNext()) { + String columnName = (String) i.next(); + String pkTableName = columnName.substring(0, columnName.indexOf(idSpell));//_id, _Id, _iD, _ID anything + String fkTableName = (String) impliedRelationships.get(columnName); + List pkTableProperties = (List) tableToPropertyMap.get(configWrapper.getTableTypeName(pkTableName)); + if ((pkTableProperties != null) && (pkTableProperties.contains("ID"))) { + configWrapper.addImpliedRelationship(pkTableName, fkTableName, columnName); + } + } + // Add any tables defined in the model but not included in the ResultSet + // to the list of propertyNames + Config model = configWrapper.getConfig(); + if (model != null) { + Iterator tablesFromModel = model.getTable().iterator(); + while (tablesFromModel.hasNext()) { + TableWrapper t = new TableWrapper((Table) tablesFromModel.next()); + if (tableToPropertyMap.get(t.getTypeName()) == null) { + tableToPropertyMap.put(t.getTypeName(), Collections.EMPTY_LIST); + } + } + } + } + + //Now fill tableToPrimaryKeysMap.Complete for whichever tables are there in tableToPrimaryKeysMap, + //Also case of implied PK and it is not there in SELECT, provide way to still fill it in + //tableToPrimaryKeysMap - the column should be present in Config (though not defed as PK) + //And consider the classic case, when we assume all columns to be PKs - when no info + //in config for table or "all columns" + private void fillTableToPrimaryKeysMap(){ + Iterator itr = tableToPropertyMap.keySet().iterator(); + while(itr.hasNext()){ + String curTableName = (String)itr.next(); + boolean treatAllPKs = false;//flag for, when all cols need to be treated as PKs + + if(tableToPrimaryKeysMap.containsKey(curTableName)){ + continue;//don't keep refilling same hashset for each ResultMetadata constructor, + } + + List columnsForTable = null; + if(configWrapper.getTableByTypeName(curTableName) != null) { + columnsForTable = configWrapper.getTableByTypeName(curTableName).getColumn(); + } + else if(configWrapper.getTable(curTableName) != null){ + columnsForTable = configWrapper.getTable(curTableName).getColumn(); + configWrapper.getTable(curTableName).setTypeName(curTableName);//keep configWrapper consistent with Type info + } + else{ + treatAllPKs = true;//can not find table/type, need to consider all columns as PKs + } + + if(columnsForTable != null){ + for(int ii=0; ii 0); + this.resultSetSize = m.getResultSetSize(); + cacheMetadata(); + getAllTableNamesForRS(); + getTablesWithNoPK(); + } + + /** + * Processes a single row in the ResultSet. + * + * @param rs + * A ResultSet positioned on the desired row + */ + public final void processRow(ResultSet rs) throws SQLException { + // clear previous data + for (Iterator itTableData = allTableData.iterator(); itTableData.hasNext(); ) { + TableData tableData = (TableData) itTableData.next(); + tableData.clear(); + } + allTableData = new ArrayList(); + // set current resultSet + currentResultSet = rs; + // process row + if (recursive) { + processRecursiveRow(); + } else { + processNonRecursiveRow(); + } + } + + public final TableData processRowForTable(String tablePropertyName) throws SQLException { + int[] indexes = (int[]) indexesByTablePropertyName.get(tablePropertyName); + TableData table = getRawData(tablePropertyName); + int count = indexes.length; + for (int j = 0; j < count; j++) { + int i = indexes[j]; + if (!isPKColumn[i]) { + // skipping primary key columns since they've already been processed by processRow() + Object data = getObject(currentResultSet, i); + if (this.logger.isDebugEnabled()) { + this.logger.debug("Adding column: " + columnPropertyNames[i] + "\tValue: " + + data + "\tTable: " + + tablePropertyNames[i]); + } + table.addData(columnPropertyNames[i], false, data); + } + } + return table; + } + + private void processNonRecursiveRow() throws SQLException { + // parse primary keys only + // the rest will be parsed as needed + int count = indexesForPKs.length; + for (int j = 0; j < count; j++) { + int i = indexesForPKs[j]; + Object data = getObject(currentResultSet, i); + if (data == null) { + // primary key is null, check other columns + String tablePropertyName = tablePropertyNames[i]; + // if table data already exists then this has already been done + if (!tableMap.containsKey(tablePropertyName)) { + TableData table = getRawData(tablePropertyName); + processRowForTable(tablePropertyName); + // add table data only if not empty + if (!table.isTableEmpty()) { + table.addData(columnPropertyNames[i], true, data); + allTableData.add(table); + } + } + } else { + // add table data + TableData table = getRawData(tablePropertyNames[i]); + if (!allTableData.contains(table)) allTableData.add(table); + if (this.logger.isDebugEnabled()) { + this.logger.debug("Adding column: " + columnPropertyNames[i] + "\tValue: " + + data + "\tTable: " + + tablePropertyNames[i]); + } + table.addData(columnPropertyNames[i], true, data); + } + } + checkResultSetMissesPK(); + } + + //get all table names involved in current result set + //can not use metadata.getAllTablePropertyNames() + //as it gives table names for all tables from Config + private void getAllTableNamesForRS(){ + allTableNames = new HashSet(resultSetSize); + for (int i = 1; i <= resultSetSize; i++) { + allTableNames.add(tablePropertyNames[i]); + } + } + + private void cacheMetadata() { + tablePropertyNames = new String[resultSetSize + 1]; + columnPropertyNames = new String[resultSetSize + 1]; + isPKColumn = new boolean[resultSetSize + 1]; + String tablePropertyName = null; + boolean isPK; + List pkColumnList = new ArrayList(); + // loop thru indexes + for (int i = 1; i <= resultSetSize; i++) { + columnPropertyNames[i] = metadata.getColumnPropertyName(i); + tablePropertyName = metadata.getTablePropertyName(i); + tablePropertyNames[i] = tablePropertyName; + List indexes = (List) indexesByTablePropertyName.get(tablePropertyName); + if (indexes == null) { + indexes = new ArrayList(); + indexesByTablePropertyName.put(tablePropertyName, indexes); + } + indexes.add(new Integer(i)); + isPK = metadata.isPKColumn(i); + isPKColumn[i] = isPK; + if (isPK) { + pkColumnList.add(new Integer(i)); + } + } + // reorganize indexes by table property name + for (Iterator itTablePropertyNames = indexesByTablePropertyName.keySet().iterator(); itTablePropertyNames.hasNext(); ) { + tablePropertyName = (String) itTablePropertyNames.next(); + List indexes = (List) indexesByTablePropertyName.get(tablePropertyName); + int count = indexes.size(); + int[] indexArray = new int[count]; + for (int i = 0; i < count; i++) { + indexArray[i] = ((Integer) indexes.get(i)).intValue(); + } + indexesByTablePropertyName.put(tablePropertyName, indexArray); + } + // reorganize indexes for PKs + int count = pkColumnList.size(); + indexesForPKs = new int[count]; + for (int i = 0; i < count; i++) { + indexesForPKs[i] = ((Integer) pkColumnList.get(i)).intValue(); + } + } + + private void getTablesWithNoPK(){ + //case when result set omits PK column, take care of compound PKs too + boolean tableRSHasPK; + Iterator itr = allTableNames.iterator(); + while(itr.hasNext()){ + tableRSHasPK = false; + String currentTableName = (String)itr.next(); + HashSet pks = metadata.getAllPKsForTable(currentTableName); + HashSet pksInRS = new HashSet(); + for(int j=1; j<=resultSetSize; j++){ + if(currentTableName.equals(tablePropertyNames[j]) && + isPKColumn[j] ){ + pksInRS.add(columnPropertyNames[j]); + } + } + + //if pks null, means its classic case when all cols should be PKs + if(pks == null){ + tableRSHasPK = true; + } + //case when there were cols in cfg but could not find any PK in it and no ID column in cfg + else if(pks != null && pks.size()==1 && pks.contains("")){ + tableRSHasPK = false; + } + else if(pks != null && pksInRS.size() == pks.size()){ + Iterator itr1 = pks.iterator(); + int indx=0; + while(itr1.hasNext()){ + if(!pksInRS.contains((String)itr1.next())){ + indx++; + } + } + + if(indx == 0){ + if (this.logger.isDebugEnabled()) { + this.logger.debug("has PK TRUE - matched"); + } + tableRSHasPK = true; + }else{ + if (this.logger.isDebugEnabled()) { + this.logger.debug("has PK FALSE- mismatched"); + } + tableRSHasPK = false; + } + } + else{ + if (this.logger.isDebugEnabled()) { + this.logger.debug("has PK FALSE - rest all cases"); + } + } + + if (!tableRSHasPK) tablesWithNoPK.add(currentTableName); + + if (this.logger.isDebugEnabled()) { + this.logger.debug("table "+currentTableName+" hasValidPK "+tableRSHasPK); + } + } + } + + private void checkResultSetMissesPK(){ + //Default is TRUE(from TableData), so consider only FALSE case + Iterator itr = tablesWithNoPK.iterator(); + while(itr.hasNext()){ + String currentTableName = (String)itr.next(); + TableData table = getRawData(currentTableName); + table.setValidPrimaryKey(false); + allTableData.add(table); + } + } + + private void processRecursiveRow() throws SQLException { + int i = 1; + // create map to keep track of recursive indexes + // each recursive table contains a 0-based index to keep track of the sequence + Map recursiveIndexes = new HashMap(); + for (Iterator itTablePropertyNames = recursiveTablePropertyNames.iterator(); itTablePropertyNames.hasNext(); ) { + recursiveIndexes.put(itTablePropertyNames.next(), new Integer(-1)); + } + + // loop thru result set columns + // assuming that the columns of each recursive table are grouped together (metadata do not allow for further granularity) + while (i <= resultSetSize) { + TableData table; + String tablePropertyName = tablePropertyNames[i]; + if (recursiveTablePropertyNames.contains(tablePropertyName)) { + // increment current recursive index for table + int recursiveIndex = ((Integer) recursiveIndexes.get(tablePropertyName)).intValue() + 1; + recursiveIndexes.put(tablePropertyName, new Integer(recursiveIndex)); + // get table data + table = getRecursiveRawData(tablePropertyName, recursiveIndex); + } else { + table = getRawData(tablePropertyNames[i]); + } + + while ((i <= resultSetSize) && (isPKColumn[i])) { + Object data = getObject(currentResultSet, i); + if (this.logger.isDebugEnabled()) { + this.logger.debug("Adding column: " + columnPropertyNames[i] + + "\tValue: " + data + "\tTable: " + + tablePropertyNames[i]); + } + table.addData(columnPropertyNames[i], true, data); + i++; + } + + while ((i <= resultSetSize) && (!isPKColumn[i])) { + Object data = getObject(currentResultSet, i); + if (this.logger.isDebugEnabled()) { + this.logger.debug("Adding column: " + columnPropertyNames[i] + + "\tValue: " + data + "\tTable: " + + tablePropertyNames[i]); + } + table.addData(columnPropertyNames[i], false, data); + i++; + } + + // skip table if empty + if (table.isTableEmpty()) { + table.clear(); + } else { + this.allTableData.add(table); + } + + } + + checkResultSetMissesPK(); + } + + /** + * @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; + } + + return metadata.convert(i, data); + + } + + /** + * 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; + } + + private TableData getRecursiveRawData(String tableName, int recursiveIndex) { + String key = tableName + ":" + recursiveIndex; + TableData table = (TableData) tableMap.get(key); + + if (table == null) { + table = new TableData(tableName, recursiveIndex); + tableMap.put(key, table); + } + + return table; + } + + public List getAllTableData() { + return this.allTableData; + } + + public boolean isRecursive() { + return recursive; + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/RowObjects.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/RowObjects.java new file mode 100644 index 0000000000..b41b7379c8 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/RowObjects.java @@ -0,0 +1,205 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.log4j.Logger; +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 commonj.sdo.DataObject; +import commonj.sdo.Property; + +public class RowObjects { + private static final Logger logger = Logger.getLogger(RowObjects.class); + + private Map objectsByTableName; + + private List tableObjects; + + private Set newTableObjectNames; + + private Map tableTypeNames; + + private Map relationshipMap; + + private final GraphBuilderMetadata metadata; + + private final TableRegistry registry; + + private final MappingWrapper configWrapper; + + private final boolean hasRecursiveRelationships; + + public RowObjects(GraphBuilderMetadata metadata, TableRegistry registry) { + objectsByTableName = new HashMap(); + tableObjects = new ArrayList(); + newTableObjectNames = new HashSet(); + tableTypeNames = new HashMap(); + this.metadata = metadata; + this.registry = registry; + this.configWrapper = metadata.getConfigWrapper(); + this.hasRecursiveRelationships = configWrapper.hasRecursiveRelationships(); + if (!hasRecursiveRelationships) buildRelationshipMap(); + } + + private void buildRelationshipMap() { + relationshipMap = new HashMap(); + Iterator i = metadata.getRelationships().iterator(); + while (i.hasNext()) { + Relationship r = (Relationship) i.next(); + String parentTypeName = getTableTypeName(r.getPrimaryKeyTable()); + String childTypeName = getTableTypeName(r.getForeignKeyTable()); + // Add relationship under child type name + List relationships = (List) relationshipMap.get(childTypeName); + if (relationships == null) { + relationships = new ArrayList(); + relationshipMap.put(childTypeName, relationships); + } + relationships.add(r); + // Add relationship under parent type name + relationships = (List) relationshipMap.get(parentTypeName); + if (relationships == null) { + relationships = new ArrayList(); + relationshipMap.put(parentTypeName, relationships); + } + relationships.add(r); + } + } + + public void clear() { + objectsByTableName.clear(); + tableObjects.clear(); + newTableObjectNames.clear(); + } + + public void put(String key, DataObject value, boolean newlyCreated) { + objectsByTableName.put(key, value); + tableObjects.add(value); + if (newlyCreated) newTableObjectNames.add(key); + } + + public DataObject get(String tablePropertyName) { + return (DataObject) objectsByTableName.get(tablePropertyName); + } + + private String getTableTypeName(String tableName) { + String typeName = (String) tableTypeNames.get(tableName); + if (typeName == null) { + typeName = configWrapper.getTableTypeName(tableName); + tableTypeNames.put(tableName, typeName); + } + return typeName; + } + + public void processRelationships() { + if (hasRecursiveRelationships) { + processRecursiveRelationships(configWrapper); + return; + } + + // the relationship needs to be set only if the parent or the child is newly created + // otherwise the relationship has already been set + Set relationshipsToSet = new HashSet(); + Iterator itNewTableObjectNames = newTableObjectNames.iterator(); + while (itNewTableObjectNames.hasNext()) { + List relationships = (List) relationshipMap.get((String) itNewTableObjectNames.next()); + if (relationships != null) relationshipsToSet.addAll(relationships); + } + + Iterator i = relationshipsToSet.iterator(); + while (i.hasNext()) { + Relationship r = (Relationship) i.next(); + + String parentTypeName = getTableTypeName(r.getPrimaryKeyTable()); + String childTypeName = getTableTypeName(r.getForeignKeyTable()); + DataObject parent = get(parentTypeName); + DataObject child = get(childTypeName); + + if (this.logger.isDebugEnabled()) { + this.logger.debug("Parent table: " + parent); + this.logger.debug("Child table: " + child); + } + + setOrAdd(parent, child, r.getName()); + } + } + + 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); + + + setOrAdd(parentTable, table, r.getName()); + } + + } + } + + private void setOrAdd(DataObject parent, DataObject child, String propertyName) { + if (parent == null || child == null) return; + Property p = parent.getType().getProperty(propertyName); + if (p.isMany()) { + parent.getList(p).add(child); + } else { + parent.set(p, child); + } + } + + private DataObject findParentTable(DataObject childTable, Relationship r, MappingWrapper wrapper) { + + List 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)); + } + + if (this.logger.isDebugEnabled()) { + this.logger.debug("Trying to find parent of " + r.getForeignKeyTable() + " with FK " + fkValue); + } + + DataObject parentTable = registry.get(r.getPrimaryKeyTable(), fkValue); + + if (this.logger.isDebugEnabled()) { + this.logger.debug("Parent table from registry: " + parentTable); + } + + return parentTable; + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/SingleTableRegistry.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/SingleTableRegistry.java new file mode 100644 index 0000000000..54474fa4b3 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/SingleTableRegistry.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 { + + + public SingleTableRegistry() { + // Empty Constructor + } + + public DataObject get(String tableName, List primaryKey) { + return null; + } + + + public void put(String tableName, List primaryKey, DataObject value) { + // do nothing + + } + + public boolean contains(String name, List list) { + return false; + } + + public void remove(String tableName, List primaryKey) { + + } +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java new file mode 100644 index 0000000000..a99f7ff12f --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java @@ -0,0 +1,123 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 java.util.Map; + +import org.apache.log4j.Logger; + +public final class TableData { + private static final Logger logger = Logger.getLogger(TableData.class); + + private Map columnData; + + private List primaryKey;; + + private final String name; + + private int index = 0; + + private boolean hasValidPrimaryKey = true; + + private boolean hasNullPrimaryKey = false; + + public TableData(String tableName) { + if (this.logger.isDebugEnabled()) { + this.logger.debug("Creating TableData for table " + tableName); + } + + this.name = tableName; + this.columnData = new HashMap(); + this.primaryKey = new ArrayList(); + } + + public TableData(String tableName, int index) { + this(tableName); + this.index = index; + } + + public void clear() { + columnData.clear(); + primaryKey.clear(); + hasValidPrimaryKey = true; + hasNullPrimaryKey = false; + } + + public void addData(String columnName, boolean isPrimaryKeyColumn, Object data) { + if (this.logger.isDebugEnabled()) { + this.logger.debug("Adding column " + columnName + " with value " + data); + } + + if(data != null) + columnData.put(columnName, data); + if (isPrimaryKeyColumn) { + if (data == null) { + if (this.logger.isDebugEnabled()) { + this.logger.debug("Column " + columnName + " is a primary key column and is null"); + } + hasNullPrimaryKey = true; + //hasValidPrimaryKey = false; - if uncommented and JIRA-1464, RecursiveTests.testReadEngineParts() will fail + } else { + primaryKey.add(data); + } + } + } + + public Object getColumnData(String columnName) { + return columnData.get(columnName); + } + + public String getTableName() { + return this.name; + } + + public int getIndex() { + return index; + } + + /** + * @return + */ + public List getPrimaryKeyValues() { + // the primary key is kept in the table registry + // so return a copy to prevent deletion + List primaryKeyCopy = new ArrayList(primaryKey.size()); + primaryKeyCopy.addAll(primaryKey); + return primaryKeyCopy; + } + + public boolean hasValidPrimaryKey() { + return hasValidPrimaryKey; + } + + public void setValidPrimaryKey(boolean hasValidPK){ + this.hasValidPrimaryKey = hasValidPK; + } + + public boolean isTableEmpty(){ + return columnData.keySet().isEmpty(); + } + + public boolean hasNullPrimaryKey(){ + return this.hasNullPrimaryKey; + } +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableRegistry.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableRegistry.java new file mode 100644 index 0000000000..7a433fe240 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableRegistry.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 DataObject + */ + DataObject get(String tableName, List primaryKey); + + /** + * Add the table with the specified name and primary key + * + * @param tableName + * @param primaryKey + * @param value + */ + void put(String tableName, List primaryKey, DataObject value); + + boolean contains(String name, List list); + + void remove(String tableName, List primaryKey); +} \ No newline at end of file diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ResultSetTypeMap.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ResultSetTypeMap.java new file mode 100644 index 0000000000..35701f88d0 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ResultSetTypeMap.java @@ -0,0 +1,137 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 final ResultSetTypeMap INSTANCE = new ResultSetTypeMap(); + + /** + * Constructor for ResultSetTypeMap. + */ + protected ResultSetTypeMap() { + // Empty Constructor + } + + /** + * + * @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"); + } + return helper.getType("commonj.sdo", "boolean"); + + + case Types.TINYINT: + case Types.SMALLINT: + case Types.INTEGER: + if (isNullable) { + return helper.getType("commonj.sdo", "IntObject"); + } + + return helper.getType("commonj.sdo", "Int"); + + + case Types.BIGINT: + if (isNullable) { + return helper.getType("commonj.sdo", "Long"); + } + return helper.getType("commonj.sdo", "long"); + + case Types.REAL: + if (isNullable) { + return helper.getType("commonj.sdo", "Float"); + } + return helper.getType("commonj.sdo", "float"); + + + case Types.FLOAT: + case Types.DOUBLE: + if (isNullable) { + return helper.getType("commonj.sdo", "Double"); + } + return helper.getType("commonj.sdo", "double"); + + + case Types.BINARY: + case Types.VARBINARY: + case Types.LONGVARBINARY: + return helper.getType("commonj.sdo", "Bytes"); + + case Types.DATE: + case Types.TIME: + case Types.TIMESTAMP: + return helper.getType("commonj.sdo", "Date"); + + case Types.CLOB: + return helper.getType("commonj.sdo", "Object"); + + case Types.BLOB: + return helper.getType("commonj.sdo", "Bytes"); + + case Types.ARRAY: + return helper.getType("commonj.sdo", "Object"); + + 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/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ApplyChangesCommandImpl.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ApplyChangesCommandImpl.java new file mode 100644 index 0000000000..b19aab85e8 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ApplyChangesCommandImpl.java @@ -0,0 +1,79 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.log4j.Logger; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; + +import commonj.sdo.DataObject; + +/** + * + */ +public class ApplyChangesCommandImpl extends BaseCommandImpl { + + private final Logger logger = Logger.getLogger(ApplyChangesCommandImpl.class); + + private ChangeSummarizer summarizer = new ChangeSummarizer(); + + public ApplyChangesCommandImpl(MappingWrapper config, Connection connection) { + this.configWrapper = config; + if (connection != null) { + setConnection(connection, config.getConfig()); + } + + } + + public void setConnection(ConnectionImpl connection) { + summarizer.setConnection(connection); + } + + public void execute(DataObject root) { + if (this.logger.isDebugEnabled()) { + this.logger.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/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/BaseCommandImpl.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/BaseCommandImpl.java new file mode 100644 index 0000000000..e6611e0a7f --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/BaseCommandImpl.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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(); + + //when no config in method params, useGetGeneratedKeys will default to True + //as DBMS metadata method is not reliable in all cases + public void setConnection(Connection connection) { + setConnection(new ConnectionImpl(connection)); + } + + public void setConnection(Connection connection, Config config) { + boolean managed = true; + String generatedKeysSupported = null; + + if (config != null){ + if(config.getConnectionInfo() != null) { + managed = config.getConnectionInfo().isManagedtx(); + } + + generatedKeysSupported = config.getGeneratedKeysSupported(); + + setConnection(connection, managed, generatedKeysSupported); + } + else{ + setConnection(connection); + } + } + + public void setConnection(Connection connection, boolean manageTransaction, String generatedKeysSupported) { + ConnectionImpl c = new ConnectionImpl(connection); + c.setManageTransactions(manageTransaction); + c.setGeneratedKeysSupported(generatedKeysSupported); + setConnection(c); + } + + public abstract void setConnection(ConnectionImpl c); + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeFactory.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeFactory.java new file mode 100644 index 0000000000..f8c669ed43 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeFactory.java @@ -0,0 +1,189 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.log4j.Logger; +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 commonj.sdo.DataObject; + +public class ChangeFactory { + private final Logger logger = Logger.getLogger(ChangeFactory.class); + + private InsertCommandImpl createCommand; + + private UpdateCommandImpl updateCommand; + + private DeleteCommandImpl deleteCommand; + + private final MappingWrapper mapping; + + private final ConnectionImpl connection; + + public ChangeFactory(MappingWrapper mapping, ConnectionImpl connection) { + this.mapping = mapping; + this.connection = connection; + } + + public void setCreateCommand(InsertCommandImpl cmd) { + createCommand = cmd; + } + + public void setUpdateCommand(UpdateCommandImpl cmd) { + if (this.logger.isDebugEnabled()) { + this.logger.debug("Setting Update Command to " + cmd); + } + + updateCommand = cmd; + } + + public void setDeleteCommand(DeleteCommandImpl cmd) { + deleteCommand = cmd; + } + + ChangeOperation createUpdateOperation(DataObject changedObject, String propagatedID) { + UpdateCommandImpl cmd = getUpdateCommand(changedObject); + if (cmd == null) { + return null; + } else { + return new UpdateOperation(cmd, 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); + } + + 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(mapping, table);//JIRA-952 + } else { + deleteCommand = new DeleteCommandImpl(delete); + } + deleteCommand.setConnection(connection); + deleteCommand.configWrapper = mapping; + } + return deleteCommand; + } + + private UpdateCommandImpl getUpdateCommand(DataObject changedObject) { + + Table table = mapping.getTableByTypeName(changedObject.getType().getName()); + if (table == null) { + if (changedObject.getType().getProperty("ID") != null) { + 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); + } + } + + if (updateCommand != null) { + updateCommand.setConnection(connection); + updateCommand.configWrapper = mapping; + } else { + if(this.logger.isDebugEnabled()) { + this.logger.debug("Update command is NULL"); + } + } + + if (this.logger.isDebugEnabled()) { + this.logger.debug("Returning updateCommand: " + updateCommand); + } + + return updateCommand; + } + + public MappingWrapper getConfig() { + return this.mapping; + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeOperation.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeOperation.java new file mode 100644 index 0000000000..b222c18177 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeOperation.java @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.log4j.Logger; + +import commonj.sdo.DataObject; + +/** + */ +public abstract class ChangeOperation { + protected DatabaseObject dObject; + + protected String propagatedID; + + private final Logger logger = Logger.getLogger(ChangeOperation.class); + + private final WriteCommandImpl writeCommand; + + private boolean isInsert; + + + 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() { + if (this.logger.isDebugEnabled()) { + this.logger.debug("Executing change operation"); + } + + Iterator i = writeCommand.getParameters().iterator(); + while (i.hasNext()) { + ParameterExtendedImpl parm = (ParameterExtendedImpl) i.next(); + + if (this.logger.isDebugEnabled()) { + this.logger.debug("setting " + parm.getName() + " to " + dObject.get(parm.getName())); + } + + parm.setValue(dObject.get(parm.getName())); + } + + writeCommand.basicExecute(); + + if (isInsert && (propagatedID != null)) { + if (this.logger.isDebugEnabled()) { + this.logger.debug("Propagating key " + propagatedID); + } + int id = writeCommand.getGeneratedKey(); + dObject.setPropagatedID(propagatedID, id); + } + } + + public String getTableName() { + return dObject.getTableName(); + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeSummarizer.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeSummarizer.java new file mode 100644 index 0000000000..0f83dcd939 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeSummarizer.java @@ -0,0 +1,268 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 java.util.Map; + +import org.apache.log4j.Logger; +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.CollectionsUtil; +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 final Logger logger = Logger.getLogger(ChangeSummarizer.class); + + private Changes changes = new Changes(); + + private FactoryRegistry registry; + + private MappingWrapper mapping = new MappingWrapper(); + + private ConnectionImpl connection; + + private Map 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(); + + if (this.logger.isDebugEnabled()) { + this.logger.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)) { + if (this.logger.isDebugEnabled()) { + this.logger.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()); + if (this.logger.isDebugEnabled()) { + this.logger.debug("Change is a delete"); + } + changes.addDelete(factory.createDeleteOperation(changedObject)); + } else { + if (this.logger.isDebugEnabled()) { + this.logger.debug("Change is a modify"); + } + List attrList = changeSummary.getOldValues(changedObject); + if (hasAttributeChange(attrList)) { + ChangeFactory factory = getRegistry().getFactory(changedObject.getType()); + if (this.logger.isDebugEnabled()) { + this.logger.debug("Attribute Change for " + changedObject.getType().getName()); + } + String propagatedID = (String) generatedKeys.get(changedObject.getType().getName()); + ChangeOperation op = factory.createUpdateOperation(changedObject, propagatedID); + if (op != null) { + changes.addUpdate(op); + } else { + if(this.logger.isDebugEnabled()) { + this.logger.debug("Update Operation is NULL"); + } + } + + } else { + List values = changeSummary.getOldValues(changedObject); + Iterator i = values.iterator(); + while (i.hasNext()) { + ChangeSummary.Setting setting = (ChangeSummary.Setting) i.next(); + if (!setting.getProperty().getType().isDataType()) { + if (this.logger.isDebugEnabled()) { + this.logger.debug("Reference change for " + changedObject.getType().getName()); + } + Property ref = setting.getProperty(); + if (this.logger.isDebugEnabled()) { + this.logger.debug(ref.getName()); + } + if (hasState(ref, changedObject)) { + ChangeFactory factory = getRegistry().getFactory(changedObject.getType()); + ChangeOperation op = factory.createUpdateOperation(changedObject); + if (op != null) { + changes.addUpdate(op); + } else { + if(this.logger.isDebugEnabled()) { + this.logger.debug("Update Operation is NULL"); + } + } + + } + } + } + } + } + + } + + private boolean hasState(Property ref, DataObject changedObject) { + if (ref.getOpposite().isMany()) { + return true; + } + + 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()) { + if (rel.isKeyRestricted()) { + throw new RuntimeException("Can not modify a one to one relationship that is key restricted"); + } + // 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())) + && (CollectionsUtil.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()) { + //if SDO type, property is defined use it , else use dbms metadata + //with this static DOs will work correct for generated keys + if(t.getTypeName() != null && c.getPropertyName() != null) { + if (this.logger.isDebugEnabled()) { + this.logger.debug("adding generated key " + t.getTypeName() + "." + c.getPropertyName()); + } + + generatedKeys.put(t.getTypeName(), c.getPropertyName()); + } else { + if (this.logger.isDebugEnabled()) { + this.logger.debug("adding generated key " + t.getTableName() + "." + c.getColumnName()); + } + + generatedKeys.put(t.getTableName(), c.getColumnName()); + } + + } + } + } + } + + public ConnectionImpl getConnection() { + return this.connection; + } +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Changes.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Changes.java new file mode 100644 index 0000000000..45f0a55719 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Changes.java @@ -0,0 +1,82 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 java.util.List; + +/** + * Manages 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 = deletes.getSortedList().iterator(); + while (i.hasNext()) { + ChangeOperation c = (ChangeOperation) i.next(); + c.execute(); + } + + 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(); + } + + } + + public void setInsertOrder(List insertOrder) { + inserts.setOrder(insertOrder); + } + + public void setDeleteOrder(List deleteOrder) { + deletes.setOrder(deleteOrder); + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CollisionParameter.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CollisionParameter.java new file mode 100644 index 0000000000..48ff2ab57a --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CollisionParameter.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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; + +public class CollisionParameter extends ParameterExtendedImpl { + + private boolean isSet; + + public void setValue(Object value) { + if (!isSet) { + this.value = value; + isSet = true; + } + } +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandImpl.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandImpl.java new file mode 100644 index 0000000000..6b1a2ad179 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandImpl.java @@ -0,0 +1,160 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 java.util.List; + +import org.apache.tuscany.das.rdb.Command; + +import commonj.sdo.DataObject; + +public abstract class CommandImpl extends BaseCommandImpl implements Command { + + protected Statement statement; + + protected ParametersExtendedImpl parameters = new ParametersExtendedImpl(); + + protected ResultSetShape resultSetShape; + + public CommandImpl(String sqlString) { + statement = new Statement(sqlString); + } + + public CommandImpl(org.apache.tuscany.das.rdb.config.Command command) { + this(command.getSQL()); + + if(command.getParameter() != null && command.getParameter().size() > 0) { + Iterator itr = command.getParameter().iterator(); + int index = 1; + while(itr.hasNext()){ + org.apache.tuscany.das.rdb.config.impl.ParameterImpl param = (org.apache.tuscany.das.rdb.config.impl.ParameterImpl)itr.next(); + if(param.getIndex() <= 0){ + param.setIndex(index); + index++; + } + ParameterExtendedImpl paramExt = new ParameterExtendedImpl(param); + addToParameters(paramExt); + } + } + } + + private void addToParameters(ParameterExtendedImpl paramExt) { + this.parameters.getParameter().add(paramExt); + if(paramExt.getDirection().equals(ParameterExtendedImpl.IN)){ + parameters.getInParameters().add(paramExt); + } + else{ + parameters.getOutParameters().add(paramExt); + } + } + + public abstract void execute(); + + public abstract DataObject executeQuery(); + + public void setParameter(int index, Object value) { + ParameterExtendedImpl param = parameters.getParameter(index); + if(param != null){ + param.setValue(value); + return; + } + + param = new ParameterExtendedImpl(); + param.setIndex(index); + param.setValue(value); + param.setDirection(ParameterExtendedImpl.IN); + parameters.getParameter().add(param); + parameters.getInParameters().add(param); + } + + public void addParameter(ParameterExtendedImpl param) { + //eliminate/replace duplicate params, index is filled, so can check it for duplicate + ParameterExtendedImpl paramExt = parameters.getParameter(param.getIndex()); + if(paramExt != null) + paramExt = new ParameterExtendedImpl(param); + + paramExt = parameters.getParameter(param.getIndex(), param.getDirection()); + if(paramExt != null){ + paramExt = new ParameterExtendedImpl(param); + return; + } + + addToParameters(param); + } + + public List getParameters() { + return parameters.getParameter(); + } + + public Object getParameter(int index) { + return parameters.getParameter(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(); + } + + //default direction IN assumed + public void setParameter(String name, Object value) { + ParameterExtendedImpl param = parameters.getParameter(name); + if(param != null){ + param.setValue(value); + return; + } + + param = new ParameterExtendedImpl(); + param.setIndex(parameters.getParameter().size()+1); + param.setName(name); + param.setValue(value); + param.setDirection(ParameterExtendedImpl.IN); + parameters.getParameter().add(param); + parameters.getInParameters().add(param); + } + + //default direction IN assumed + public Object getParameter(String name) { + Iterator itr = this.parameters.getInParameters().iterator(); + while(itr.hasNext()){ + ParameterExtendedImpl param = ((ParameterExtendedImpl)itr.next()); + + if(param.getName() != null && param.getName().equalsIgnoreCase(name)){ + return param.value; + } + } + return null; + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java new file mode 100644 index 0000000000..5ee465027d --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java @@ -0,0 +1,154 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.DatabaseMetaData; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; + +import org.apache.log4j.Logger; + +public class ConnectionImpl { + + private final Logger logger = Logger.getLogger(ConnectionImpl.class); + + private Connection connection; + + private boolean managingTransaction = true; + + private String generatedKeysSupported = null; + + 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 String getGeneratedKeysSupported() { + return this.generatedKeysSupported; + } + + public void setGeneratedKeysSupported(String useGetGeneratedKeys){ + this.generatedKeysSupported = useGetGeneratedKeys; + } + + public boolean isGeneratedKeysSupported() { + try{ + if(this.generatedKeysSupported == null){ + DatabaseMetaData dbmsMetadata = this.connection.getMetaData(); + boolean supportsGetGeneratedKeys = dbmsMetadata.supportsGetGeneratedKeys(); + if(supportsGetGeneratedKeys){ + this.generatedKeysSupported = "true"; + } + //currently DERBY partially supports this feature and thus returns FALSE, + //this hardcoding is needed as the partial support is enough for DAS + //we can remove this later, when DERBY change the behaviour of it's "supportsGetGeneratedKeys" + else if(dbmsMetadata.getDatabaseProductName().indexOf("Derby") > 0){ + this.generatedKeysSupported = "true"; + } + else{ + this.generatedKeysSupported = "false"; + } + } + }catch(Exception e){//can be from supportsGetGeneratedKeys or due to absense of supportsGetGeneratedKeys + if (this.logger.isDebugEnabled()) { + this.logger.debug("exception setiing useGetGeneratedKeys false"); + } + this.generatedKeysSupported = "false"; + } + + if (this.logger.isDebugEnabled()) { + this.logger.debug("returning useGetGeneratedKeys():"+ this.generatedKeysSupported); + } + return Boolean.valueOf(this.generatedKeysSupported).booleanValue(); + } + + public void cleanUp() { + try { + if (managingTransaction) { + if (this.logger.isDebugEnabled()) { + this.logger.debug("Committing Transaction"); + } + connection.commit(); + } + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + public void errorCleanUp() { + try { + if (managingTransaction) { + if (this.logger.isDebugEnabled()) { + this.logger.debug("Rolling back Transaction"); + } + connection.rollback(); + } + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + public PreparedStatement prepareStatement(String queryString, String[] returnKeys) throws SQLException { + if (this.logger.isDebugEnabled()) { + this.logger.debug("Preparing Statement: " + queryString); + this.logger.debug("Boolean value for use gen key: " + this.generatedKeysSupported); + } + + if (isGeneratedKeysSupported()) { + return connection.prepareStatement(queryString, Statement.RETURN_GENERATED_KEYS); + } else if (returnKeys.length > 0) { + return connection.prepareStatement(queryString, returnKeys); + } + + return connection.prepareStatement(queryString); + } + + public PreparedStatement preparePagedStatement(String queryString) throws SQLException { + if (this.logger.isDebugEnabled()) { + this.logger.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/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CreateOperation.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CreateOperation.java new file mode 100644 index 0000000000..0163f96686 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CreateOperation.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASFactoryImpl.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASFactoryImpl.java new file mode 100644 index 0000000000..ba80b3bcb5 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASFactoryImpl.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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(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/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASImpl.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASImpl.java new file mode 100644 index 0000000000..e456d65ef1 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASImpl.java @@ -0,0 +1,327 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.DriverManager; +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.config.ConfigFactory; +import org.apache.tuscany.das.rdb.config.ConnectionInfo; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.exception.DataSourceInitializationException; +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 MappingWrapper configWrapper; + + private Connection connection; + + private Map commands = new HashMap(); + + public DASImpl(InputStream stream) { + this(ConfigUtil.loadConfig(stream)); + + } + + public DASImpl(Config inConfig) { + Config cfg = inConfig; + if (cfg == null) { + cfg = ConfigFactory.INSTANCE.createConfig(); + } + this.configWrapper = new MappingWrapper(cfg); + + Iterator i = configWrapper.getConfig().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, configWrapper, commandConfig.getResultDescriptor())); + } else if (kind.equalsIgnoreCase("update")) { + commands.put(commandConfig.getName(), new UpdateCommandImpl(commandConfig)); + } else if (kind.equalsIgnoreCase("insert")) { + commands.put(commandConfig.getName(), new InsertCommandImpl(commandConfig, new String[0])); + } else if (kind.equalsIgnoreCase("delete")) { + commands.put(commandConfig.getName(), new DeleteCommandImpl(commandConfig)); + } else if (kind.equalsIgnoreCase("procedure")) { + commands.put(commandConfig.getName(), new SPCommandImpl(commandConfig.getSQL(), configWrapper, commandConfig.getParameter())); + } else { + throw new RuntimeException("Invalid kind of command: " + kind); + } + + } + + } + + 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) { + this(ConfigFactory.INSTANCE.createConfig()); + setConnection(inConnection); + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.das.rdb.CommandGroup#getApplyChangesCommand() + */ + public ApplyChangesCommandImpl getApplyChangesCommand() { + ApplyChangesCommandImpl cmd = new ApplyChangesCommandImpl(configWrapper, getConnection()); + 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(), configWrapper.getConfig()); + return cmd; + } + + public void setConnection(Connection connection) { + this.connection = connection; + } + + public Connection getConnection() { + if (connection == null) { + initializeConnection(); + } + return connection; + } + + private void initializeConnection() { + Config config = configWrapper.getConfig(); + if (config == null || config.getConnectionInfo() == null || + (config.getConnectionInfo().getDataSource() == null && + (config.getConnectionInfo().getConnectionProperties() == null || config.getConnectionInfo().getConnectionProperties().getDatabaseURL() == null + || config.getConnectionInfo().getConnectionProperties().getDriverClass() == null)) ) { + throw new RuntimeException("No connection has been provided and no data source has been specified"); + } + + if(config.getConnectionInfo().getDataSource() != null && + (config.getConnectionInfo().getConnectionProperties() != null && config.getConnectionInfo().getConnectionProperties().getDatabaseURL() != null) ){ + throw new RuntimeException("Use either dataSource or databaseURL. Can't use both !"); + } + + ConnectionInfo connectionInfo = configWrapper.getConfig().getConnectionInfo(); + if(config.getConnectionInfo().getDataSource() != null){ + initializeDatasourceConnection(connectionInfo); + }else{ + initializeDriverManagerConnection(connectionInfo); + } + + } + + /** + * Initializes a DB connection on a managed environmet (e.g inside Tomcat) + */ + private void initializeDatasourceConnection(ConnectionInfo connectionInfo){ + Connection connection = null; + + InitialContext ctx; + try { + ctx = new InitialContext(); + } catch (NamingException e) { + throw new RuntimeException(e); + } + try { + DataSource ds = (DataSource) ctx.lookup(connectionInfo.getDataSource()); + try { + try { + if(connectionInfo.getConnectionProperties() != null && + connectionInfo.getConnectionProperties().getUserName() != null && + connectionInfo.getConnectionProperties().getPassword() != null ) { + connection = ds.getConnection(connectionInfo.getConnectionProperties().getUserName(), connectionInfo.getConnectionProperties().getPassword()); + } else { + connection = ds.getConnection(); + } + }catch(Exception e) { + connection = ds.getConnection(); + } + + if (connection == null) { + throw new RuntimeException("Could not obtain a Connection from DataSource"); + } + connection.setAutoCommit(false); + setConnection(connection); + } catch (SQLException e) { + throw new RuntimeException(e); + } + } catch (NamingException e) { + throw new RuntimeException(e); + } + } + + /** + * Initialize a DB connection on a J2SE environment + * For more info, see http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/drivermanager.html + */ + private void initializeDriverManagerConnection(ConnectionInfo connectionInfo) { + + Connection connection = null; + + if (connectionInfo.getConnectionProperties() == null) { + throw new DataSourceInitializationException("No existing context and no connection properties"); + } + + if (connectionInfo.getConnectionProperties().getDriverClass() == null) { + throw new DataSourceInitializationException("No jdbc driver class specified!"); + } + + try { + //initialize driver and register it with DriverManager + Class.forName(connectionInfo.getConnectionProperties().getDriverClass()); + + //prepare to initialize connection + String databaseUrl = connectionInfo.getConnectionProperties().getDatabaseURL(); + String userName = connectionInfo.getConnectionProperties().getUserName(); + String userPassword = connectionInfo.getConnectionProperties().getPassword(); + int loginTimeout = connectionInfo.getConnectionProperties().getLoginTimeout(); + + DriverManager.setLoginTimeout(loginTimeout); + if( (userName == null || userName.length() ==0) && (userPassword == null || userPassword.length()==0) ){ + //no username or password suplied + connection = DriverManager.getConnection(databaseUrl); + }else{ + connection = DriverManager.getConnection(databaseUrl, userName, userPassword); + } + + if(connection == null){ + throw new DataSourceInitializationException("Error initializing connection : null"); + } + + connection.setAutoCommit(false); + setConnection(connection); + + + }catch(ClassNotFoundException cnf){ + throw new DataSourceInitializationException("JDBC Driver '" + connectionInfo.getConnectionProperties().getDriverClass() + "' not found", cnf); + }catch(SQLException sqle){ + throw new DataSourceInitializationException(sqle.getMessage(), sqle); + } + + } + + 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 (configWrapper.getConfig().getConnectionInfo().getDataSource() == null) { + return false; + } + + return true; + + } + + public Command createCommand(String sql) { + return baseCreateCommand(sql, this.configWrapper); + } + + public Command createCommand(String sql, Config config) { + return baseCreateCommand(sql, new MappingWrapper(config)); + } + + private Command baseCreateCommand(String inSql, MappingWrapper config) { + CommandImpl returnCmd = null; + String sql = inSql.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, new String[0]); + 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.getConfig()); + return returnCmd; + } + + public void applyChanges(DataObject root) { + getApplyChangesCommand().execute(root); + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DatabaseObject.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DatabaseObject.java new file mode 100644 index 0000000000..18a6d8d193 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DatabaseObject.java @@ -0,0 +1,229 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 java.util.Map; + +import org.apache.log4j.Logger; +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.config.wrapper.TableWrapper; + +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 Logger logger = Logger.getLogger(DatabaseObject.class); + + private final MappingWrapper mappingWrapper; + + private final DataObject dataObject; + + private Property parentReference; + + private Map 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(); + if (this.logger.isDebugEnabled()) { + this.logger.debug("Initializing relationship: " + r.getName()); + this.logger.debug("r.getForeignKeyTable():"+r.getForeignKeyTable()); + this.logger.debug("getTypeName():"+getTypeName()); + } + + Table fkTable = mappingWrapper.getTableByTypeName(getTypeName()); + String fkTableName = null; + if(fkTable != null) { + if(mappingWrapper.getConfig().isDatabaseSchemaNameSupported()) { + fkTableName = fkTable.getSchemaName()+"."+fkTable.getTableName(); + } else { + fkTableName = fkTable.getTableName(); + } + } else {//this can happen when no
in Config and Query based Dynamic Types are used during query + fkTableName = getTypeName(); + } + + if (r.getForeignKeyTable().equals(fkTableName)) { + List pairs = r.getKeyPair(); + Iterator iter = pairs.iterator(); + while (iter.hasNext()) { + KeyPair pair = (KeyPair) iter.next(); + keyMappings.put(pair.getForeignKeyColumn(), r); + if (this.logger.isDebugEnabled()) { + this.logger.debug("Putting key pair: " + pair.getPrimaryKeyColumn()+","+pair.getForeignKeyColumn()); + } + } + } + } + } + } + + 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); + } + + //JIRA-952 + Table tbl = this.mappingWrapper.getTable(r.getPrimaryKeyTable()); + Property parentRef = null; + if(tbl == null){ + //this is case when config file is not present and + //ConfigHelper helper = new ConfigHelper(); is used + parentRef = getParentReference(r.getPrimaryKeyTable()); + } + else{ + //other cases, its better to use typeName as r.getPrimaryKeyTable() + //gives tableName and tableName and typeName can be different + //and SDO looks for typeName and not tableName. + parentRef = getParentReference((new TableWrapper(tbl)).getTypeName()); + } + + DataObject parent = dataObject.getDataObject(parentRef); + + if (parent == null) { + return null; + } + String parentKey = getParentKey(r, parameter);//parentKey is db column name + + String parentTableName = null; + //as parentKey is qualified column name and not SDO property name, do conversion, when possible, thru
+ tbl = mappingWrapper.getTableByTypeName(parent.getType().getName()); + if(tbl != null) { + if(mappingWrapper.getConfig().isDatabaseSchemaNameSupported()) { + parentTableName = tbl.getSchemaName()+"."+tbl.getTableName(); + } else { + parentTableName = tbl.getTableName(); + } + String parentKeyProp = mappingWrapper.getColumnPropertyName(parentTableName, parentKey); + + return parent.get(parentKeyProp); + } else { + return parent.get(parentKey); + } + } + + /*This returns table column name*/ + 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; + } + + //JIRA-952 + public String getTableName() { + if (mappingWrapper.getConfig() != null) { + + if(mappingWrapper.getConfig().isDatabaseSchemaNameSupported()){ + if (this.logger.isDebugEnabled()) { + this.logger.debug("DatabaseObject.getTableName:(schemaName.tableName) " + + mappingWrapper.getTableByTypeName(getTypeName()).getSchemaName()+"."+ + mappingWrapper.getTableByTypeName(getTypeName()).getTableName()); + } + + return (mappingWrapper.getTableByTypeName(getTypeName()).getSchemaName()+"."+ + mappingWrapper.getTableByTypeName(getTypeName()).getTableName()); + } + else{ + if (this.logger.isDebugEnabled()) { + this.logger.debug("DatabaseObject.getTableName: " + mappingWrapper.getTableByTypeName(getTypeName()).getTableName()); + } + + return mappingWrapper.getTableByTypeName(getTypeName()).getTableName(); + } + } + return null; + } + + public String getTypeName() { + if (this.logger.isDebugEnabled()) { + this.logger.debug("DatabaseObject.getTypeName: " + dataObject.getType().getName()); + } + 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/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteCommandImpl.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteCommandImpl.java new file mode 100644 index 0000000000..ca85569272 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteCommandImpl.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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(org.apache.tuscany.das.rdb.config.Command command) { + super(command); + } + + public DeleteCommandImpl(String sqlString) { + super(sqlString); + } + + public DeleteCommandImpl(Delete delete) { + super(delete.getSql()); + this.addParameters(delete.getParameters()); + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteList.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteList.java new file mode 100644 index 0000000000..feb7e31411 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteList.java @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 java.util.List; +import java.util.Map; + +/** + * DeleteList will sort delete operations so that child objects are deleted before their parents + * + * + */ +public class DeleteList { + + private Map opsByTableName = new HashMap(); + + private List order; + + private List deleteOperations = new ArrayList(); + + public DeleteList() { + super(); + } + + public void add(ChangeOperation op) { + if ((order.size() == 0) || (op.getTableName() == null)) { + deleteOperations.add(op); + } else { + String name = op.getTableName(); + List ops = (List) opsByTableName.get(name); + if (ops == null) { + ops = new ArrayList(); + } + ops.add(op); + opsByTableName.put(name, ops); + } + } + + public Collection getSortedList() { + if ((order.size() > 0) && (opsByTableName.keySet().size() > 0)) { + Iterator i = this.order.iterator(); + while (i.hasNext()) { + String name = (String) i.next(); + if (opsByTableName.get(name) != null) { + deleteOperations.addAll((Collection) opsByTableName.get(name)); + } + } + } + + return deleteOperations; + } + + public void setOrder(List deleteOrder) { + this.order = deleteOrder; + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteOperation.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteOperation.java new file mode 100644 index 0000000000..52935599c1 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteOperation.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/FactoryRegistry.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/FactoryRegistry.java new file mode 100644 index 0000000000..bb148635c8 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/FactoryRegistry.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.Map; + +import org.apache.log4j.Logger; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; + +import commonj.sdo.Type; + +public class FactoryRegistry { + + private final Logger logger = Logger.getLogger(FactoryRegistry.class); + + private Map registry = new HashMap(); + + 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) { + if (this.logger.isDebugEnabled()) { + this.logger.debug("Creating new ChangeFactory for type " + type.getName()); + } + + factory = new ChangeFactory(mapping, connection); + registry.put(type, factory); + } + return factory; + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertCommandImpl.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertCommandImpl.java new file mode 100644 index 0000000000..61967475bd --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertCommandImpl.java @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 String[] keys; + + public InsertCommandImpl(org.apache.tuscany.das.rdb.config.Command command, String[] generatedKeys) { + super(command); + keys = generatedKeys; + } + + public InsertCommandImpl(String sqlString, String[] generatedKeys) { + super(sqlString); + keys = generatedKeys; + } + + public InsertCommandImpl(Create create) { + super(create.getSql()); + this.addParameters(create.getParameters()); + this.keys = new String[0]; + } + + public void execute() { + + boolean success = false; + try { + statement.executeUpdate(parameters, keys); + success = true; + } catch (SQLException e) { + throw new RuntimeException(e); + } finally { + if (success) { + statement.getConnection().cleanUp(); + } else { + statement.getConnection().errorCleanUp(); + } + } + + } + + public int getGeneratedKey() { + try { + Integer key = statement.getGeneratedKey(); + if(key != null) + return key.intValue(); + else + throw new RuntimeException("Could not obtain generated key!"); + } catch (SQLException ex) { + throw new RuntimeException(ex); + } + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertList.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertList.java new file mode 100644 index 0000000000..e61ccfe21e --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertList.java @@ -0,0 +1,95 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + +/** + * InsertList will sort ChangeOperation objects so that parents are inserted before children + * + * + */ +public class InsertList { + private final Logger logger = Logger.getLogger(InsertList.class); + + private Map opsByTableName = new HashMap(); + + private List insertOperations = new ArrayList(); + + private List order; + + public void add(ChangeOperation op) { + if (this.logger.isDebugEnabled()) { + this.logger.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(); + List ops = (List) opsByTableName.get(name); + if (ops == null) { + ops = new ArrayList(); + } + + ops.add(op); + opsByTableName.put(name, ops); + } + } + + public Collection getSortedList() { + if (this.logger.isDebugEnabled()) { + this.logger.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(); + if (this.logger.isDebugEnabled()) { + this.logger.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)); + } + } + } + if (this.logger.isDebugEnabled()) { + this.logger.debug("Returning " + insertOperations.size() + " insert operations"); + } + + return insertOperations; + } + + public void setOrder(List insertOrder) { + this.order = insertOrder; + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ManagedParameterImpl.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ManagedParameterImpl.java new file mode 100644 index 0000000000..f2f3ccdd79 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ManagedParameterImpl.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.math.BigDecimal; + +public class ManagedParameterImpl extends ParameterExtendedImpl { + + 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 if (oldValue instanceof BigDecimal) { + return ((BigDecimal) oldValue).add(new BigDecimal(1)); + } else { + throw new RuntimeException("Unsupported type for managed column: " + oldValue.getClass().getName()); + } + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/OptimisticWriteCommandImpl.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/OptimisticWriteCommandImpl.java new file mode 100644 index 0000000000..0a5f6951e9 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/OptimisticWriteCommandImpl.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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; +import org.apache.tuscany.das.rdb.exception.OptimisticConcurrencyException; + +public class OptimisticWriteCommandImpl extends UpdateCommandImpl { + + public OptimisticWriteCommandImpl(String sqlString) { + super(sqlString); + } + + public OptimisticWriteCommandImpl(Update update) { + super(update); + addParameters(update.getParameters()); + } + + public void basicExecute() { + try { + int rowsAffected = statement.executeUpdate(parameters); + if (rowsAffected == 0) { + throw new OptimisticConcurrencyException("An update collision occurred"); + } + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/PagerImpl.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/PagerImpl.java new file mode 100644 index 0000000000..27b653763b --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/PagerImpl.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterExtendedImpl.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterExtendedImpl.java new file mode 100644 index 0000000000..db98b130ba --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterExtendedImpl.java @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.tuscany.das.rdb.config.impl.ParameterImpl; + +import commonj.sdo.Type; + +public class ParameterExtendedImpl extends ParameterImpl{ + /** + * Value for "Direction" that indicates that a parameter is soley for input. + */ + static final String IN = "IN"; + + /** + * Value for "Direction" that indicates that a parameter is soley for output. + * Out parameters only apply to Stored Procedures + */ + static final String OUT = "OUT"; + + /** + * Value for "Direction" that indicates that a parameter is for both input and output. + * In-out parameters only apply to stored procedures + */ + static final String IN_OUT = "IN_OUT"; + + private Type type; + + protected Object value; + + private Converter converter; + + public ParameterExtendedImpl() { + super(); + this.direction = IN; + } + + public ParameterExtendedImpl(org.apache.tuscany.das.rdb.config.impl.ParameterImpl parameterImpl) { + this.columnType = parameterImpl.getColumnType(); + this.direction = parameterImpl.getDirection(); + this.index = parameterImpl.getIndex(); + this.name = parameterImpl.getName(); + } + + public void setType(Type type) { + this.type = type; + } + + public Type getType() { + return this.type; + } + + public void setColumnType(String newColumnType) { + super.setColumnType(newColumnType); + if(newColumnType != null){ + String arg0 = newColumnType.substring(0, newColumnType.lastIndexOf(".")); + String arg1 = newColumnType.substring(newColumnType.lastIndexOf(".")+1); + this.type = SDODataTypes.TYPE_HELPER.getType(arg0, arg1); + } + } + + public void setValue(Object value) { + this.value = value; + } + + public Object getValue() { + if (getConverter() != null) { + return getConverter().getColumnValue(this.value); + } + + return this.value; + } + + public void setConverter(Converter converter) { + this.converter = converter; + } + + public Converter getConverter() { + return this.converter; + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterImpl.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterImpl.java new file mode 100644 index 0000000000..3e23faf069 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterImpl.java @@ -0,0 +1,120 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ + static final int IN = 1; + + /** + * Value for "Direction" that indicates that a parameter is soley for output. + * Out parameters only apply to Stored Procedures + */ + static final 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 + */ + static final int IN_OUT = 3; + + protected Object value; + + private int index; + + private Type type; + + private String name; + + private int direction = IN; + + private Converter converter; + + + public ParameterImpl() { + super(); + } + + 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); + } + + return this.value; + } + + public int getDirection() { + return this.direction; + } + + public void setConverter(Converter converter) { + this.converter = converter; + } + + public Converter getConverter() { + return this.converter; + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Parameters.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Parameters.java new file mode 100644 index 0000000000..bebfba9ce9 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Parameters.java @@ -0,0 +1,113 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.log4j.Logger; + +import commonj.sdo.Type; + +public class Parameters { + private final Logger logger = Logger.getLogger(Parameters.class); + + private List parameters = new ArrayList(); + + private List inParams = new ArrayList(); + + private List outParams = new ArrayList(); + + 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; + } + } + if (this.logger.isDebugEnabled()) { + this.logger.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/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParametersExtendedImpl.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParametersExtendedImpl.java new file mode 100644 index 0000000000..190695ae14 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParametersExtendedImpl.java @@ -0,0 +1,189 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 java.util.StringTokenizer; + +import org.apache.log4j.Logger; +import org.apache.tuscany.das.rdb.config.Parameters; +import org.apache.tuscany.das.rdb.config.impl.ParameterImpl; +import org.apache.tuscany.das.rdb.config.impl.ParametersImpl; + +import commonj.sdo.Type; + +public class ParametersExtendedImpl extends ParametersImpl{ + private final Logger logger = Logger.getLogger(ParametersExtendedImpl.class); + private List inParams = new ArrayList(); + + private List outParams = new ArrayList(); + + public ParametersExtendedImpl(){ + + } + + public ParametersExtendedImpl(List paramsList) { + if(this.parameter == null){ + this.parameter = new ArrayList(); + } + if(paramsList != null){ + for(int i=0; i JDK5 + for(Iterator it = this.resultDescriptors.iterator() ; it.hasNext();){ + + if(!(it.next() instanceof ResultDescriptor)){ + throw new RuntimeException("Elements in List not of type ResultDescriptor!"); + } + + } + refreshResultSetShape(); + } + } + + public List getResultDescriptors(){ + return this.resultDescriptors; + } + + public void addResultDescriptor(ResultDescriptor resultDescriptor){ + //if >= 0 columnIndex, add/replace for given index + //if < 0 columnIndex, add at end of current list + if(resultDescriptor == null) { + return; + } + + if(this.resultDescriptors == null){ + this.resultDescriptors = new ArrayList(); + } + + if(resultDescriptor.getColumnIndex() <0){ + this.resultDescriptors.add(deepCopyResultDescriptor(resultDescriptor));//dont care about columnIndex,add at end, old way + } + else{ + ResultDescriptor existing = getResultDescriptor(resultDescriptor.getColumnIndex()); + if(existing != null){ + removeResultDescriptor(resultDescriptor.getColumnIndex()); + } + this.resultDescriptors.add(deepCopyResultDescriptor(resultDescriptor));//add at end, sorting will happen below + } + + refreshResultSetShape(); + } + + + public ResultDescriptor removeResultDescriptor(int columnIndex){ + //if < 0 index return null + //if >=0 index and available at given index, remove and return same + //if >=0 index and not available at given index, return null + ResultDescriptor existing = null; + if(columnIndex >=0 && ((existing = getResultDescriptor(columnIndex)) != null) ){ + this.resultDescriptors.remove(existing); + refreshResultSetShape(); + return existing; + } + return null; + } + + public ResultDescriptor removeResultDescriptor(ResultDescriptor resultDescriptor){ + //remove and return only if matched for index, name, type, table name, schema name + //else return null + if(resultDescriptor != null){ + ResultDescriptor existing = getResultDescriptor(resultDescriptor.getColumnIndex()); + if(existing != null && + existing.getColumnName().equals(resultDescriptor.getColumnName()) && + existing.getColumnType().equals(resultDescriptor.getColumnType()) && + existing.getTableName().equals(resultDescriptor.getTableName()) ) { + if(this.configWrapper.getConfig().isDatabaseSchemaNameSupported()){//multi schema support + if(resultDescriptor.getSchemaName() != null && existing.getSchemaName() != null + && resultDescriptor.getSchemaName().equals(existing.getSchemaName())){ + this.resultDescriptors.remove(existing); + refreshResultSetShape(); + return existing; + } + return null; + } + else{ + this.resultDescriptors.remove(existing); + refreshResultSetShape(); + return existing; + } + } + } + return null; + } + + public ResultDescriptor getResultDescriptor(int columnIndex){ + //if <0 index return null + //if >=0 index and available at given index, return same + //if >=0 index and not available at given index, return null + if(columnIndex >=0 && this.resultDescriptors != null){ + + for(Iterator it = this.resultDescriptors.iterator() ; it.hasNext();){ + ResultDescriptor rs = (ResultDescriptor) it.next(); + + if( rs.getColumnIndex() == columnIndex){ + return rs; + } + + } + } + + return null; + } + + //Utility method + public void printResultDescriptors(OutputStream ostrm) throws IOException{ + if(this.resultDescriptors != null && this.resultDescriptors.size() != 0){ + + for(Iterator it = this.resultDescriptors.iterator() ; it.hasNext();){ + ostrm.write( it.next().toString().getBytes() ); + ostrm.write('\n'); + + } + ostrm.flush(); + + } + } + + 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 { + List results = statement.executeQuery(parameters); + success = true; + return buildGraph(results); + } catch (SQLException e) { + throw new RuntimeException(e); + } finally { + if (success) { + statement.getConnection().cleanUp(); + } else { + statement.getConnection().errorCleanUp(); + } + } + } + + protected DataObject buildGraph(List results) throws SQLException { + + // 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.getRootType()); + + SDOUtil.registerDataGraphTypes(g, gbmd.getDefinedTypes()); + + 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; + } + + + protected void enablePaging() { + statement.enablePaging(); + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ResultSetShape.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ResultSetShape.java new file mode 100644 index 0000000000..a9744d42b9 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ResultSetShape.java @@ -0,0 +1,161 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.Config; +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. + *

+ * 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; + + private final String[] schema;//JIRA-952 + //JIRA-952 + public ResultSetShape(ResultSetMetaData metadata, Config model) throws SQLException { + columns = new String[metadata.getColumnCount()]; + tables = new String[metadata.getColumnCount()]; + types = new Type[metadata.getColumnCount()]; + schema = new String[metadata.getColumnCount()]; + + ResultSetTypeMap typeMap = ResultSetTypeMap.INSTANCE; + for (int i = 1; i <= metadata.getColumnCount(); i++) { + if(model.isDatabaseSchemaNameSupported()){ + if(metadata.getSchemaName(i) != null && !metadata.getSchemaName(i).equals("")){ + //tables[i - 1] = metadata.getSchemaName(i)+"."+metadata.getTableName(i); + tables[i - 1] = metadata.getTableName(i); + schema[i - 1] = metadata.getSchemaName(i); + } + else{ + tables[i - 1] = metadata.getTableName(i); + schema[i - 1] = ""; + } + } + else{ + tables[i - 1] = metadata.getTableName(i); + schema[i - 1] = ""; + } + columns[i - 1] = metadata.getColumnName(i); + types[i - 1] = typeMap.getType(metadata.getColumnType(i), true); + } + } + + //JIRA-952 + protected ResultSetShape(List resultDescriptor, Config model) { + TypeHelper helper = TypeHelper.INSTANCE; + int size = resultDescriptor.size(); + columns = new String[size]; + tables = new String[size]; + types = new Type[size]; + schema = new String[size]; + + for (int i = 0; i < size; i++) { + ResultDescriptor desc = (ResultDescriptor) resultDescriptor.get(i); + if(model.isDatabaseSchemaNameSupported()){ + if(desc.getSchemaName() != null && !desc.getSchemaName().equals("")){ + tables[i] = desc.getTableName(); + schema[i] = desc.getSchemaName(); + }else{ + tables[i] = desc.getTableName(); + schema[i] = ""; + } + + }else{ + tables[i] = desc.getTableName(); + schema[i] = ""; + } + 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]; + } + + //JIRA-952 + public String getSchemaName(int i) { + return schema[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/schema/type: "); + for (int i = 0; i < columns.length; i++) { + result.append(columns[i]); + result.append('\t'); + result.append(tables[i]); + result.append('\t'); + result.append(schema[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/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypeHelper.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypeHelper.java new file mode 100644 index 0000000000..5f24099743 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypeHelper.java @@ -0,0 +1,189 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 final class SDODataTypeHelper { + + private SDODataTypeHelper() { + + } + + public static String columnTypeForSDOType(Type sdoType){ + if(sdoType == null) { + throw new RuntimeException("Null SDO Data Type!"); + } + + if(!sdoType.isDataType()) { + throw new RuntimeException("Invalid SDO Data Type! "+sdoType.getName()); + } + + if (sdoType == SDODataTypes.BOOLEAN) { + return SDODataTypes.BOOLEAN_STR; + } else if (sdoType == SDODataTypes.BOOLEANOBJECT) { + return SDODataTypes.BOOLEANOBJECT_STR; + } else if (sdoType == SDODataTypes.BYTE) { + return SDODataTypes.BYTE_STR; + } else if (sdoType == SDODataTypes.BYTEOBJECT) { + return SDODataTypes.BYTEOBJECT_STR; + } else if (sdoType == SDODataTypes.BYTES) { + return SDODataTypes.BYTES_STR; + } else if (sdoType == SDODataTypes.CHARACTER) { + return SDODataTypes.CHARACTER_STR; + } else if (sdoType == SDODataTypes.CHARACTEROBJECT) { + return SDODataTypes.CHARACTEROBJECT_STR; + } else if (sdoType == SDODataTypes.DATE) { + return SDODataTypes.DATE_STR; + } else if (sdoType == SDODataTypes.DATETIME) { + return SDODataTypes.DATETIME_STR; + } else if (sdoType == SDODataTypes.DAY) { + return SDODataTypes.DAY_STR; + } else if (sdoType == SDODataTypes.DECIMAL) { + return SDODataTypes.DECIMAL_STR; + } else if (sdoType == SDODataTypes.STRING) { + return SDODataTypes.STRING_STR; + } else if (sdoType == SDODataTypes.DOUBLE) { + return SDODataTypes.DOUBLE_STR; + } else if (sdoType == SDODataTypes.DOUBLEOBJECT) { + return SDODataTypes.DOUBLEOBJECT_STR; + } else if (sdoType == SDODataTypes.DURATION) { + return SDODataTypes.DURATION_STR; + } else if (sdoType == SDODataTypes.FLOAT) { + return SDODataTypes.FLOAT_STR; + } else if (sdoType == SDODataTypes.FLOATOBJECT) { + return SDODataTypes.FLOATOBJECT_STR; + } else if (sdoType == SDODataTypes.INT) { + return SDODataTypes.INT_STR; + } else if (sdoType == SDODataTypes.INTEGER) { + return SDODataTypes.INTEGER_STR; + } else if (sdoType == SDODataTypes.INTOBJECT) { + return SDODataTypes.INTOBJECT_STR; + } else if (sdoType == SDODataTypes.LONG) { + return SDODataTypes.LONG_STR; + } else if (sdoType == SDODataTypes.LONGOBJECT) { + return SDODataTypes.LONGOBJECT_STR; + } else if (sdoType == SDODataTypes.MONTH) { + return SDODataTypes.MONTH_STR; + } else if (sdoType == SDODataTypes.MONTHDAY) { + return SDODataTypes.MONTHDAY_STR; + } else if (sdoType == SDODataTypes.OBJECT) { + return SDODataTypes.OBJECT_STR; + } else if (sdoType == SDODataTypes.SHORT) { + return SDODataTypes.SHORT_STR; + } else if (sdoType == SDODataTypes.SHORTOBJECT) { + return SDODataTypes.SHORTOBJECT_STR; + } else if (sdoType == SDODataTypes.STRING) { + return SDODataTypes.STRING_STR; + } else if (sdoType == SDODataTypes.STRINGS) { + return SDODataTypes.STRINGS_STR; + } else if (sdoType == SDODataTypes.TIME) { + return SDODataTypes.TIME_STR; + } else if (sdoType == SDODataTypes.URI) { + return SDODataTypes.URI_STR; + } else if (sdoType == SDODataTypes.YEAR) { + return SDODataTypes.YEAR_STR; + } else if (sdoType == SDODataTypes.YEARMONTH) { + return SDODataTypes.YEARMONTH_STR; + } else if (sdoType == SDODataTypes.YEARMONTHDAY) { + return SDODataTypes.YEARMONTHDAY_STR; + } else { + throw new RuntimeException("Invalid SDO Data Type " + sdoType.getName()); + } + } + + public static 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.VARCHAR; + } 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.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.INTOBJECT) { + 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("Invalid SDO Data Type " + sdoType.getName()); + } + + } +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypes.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypes.java new file mode 100644 index 0000000000..db520b249f --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypes.java @@ -0,0 +1,130 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + * and due to final consts reduce number of string creation + */ +public class SDODataTypes { + + public static final TypeHelper TYPE_HELPER = TypeHelper.INSTANCE; + + public static final Type BOOLEAN = TYPE_HELPER.getType("commonj.sdo", "Boolean"); + public static final String BOOLEAN_STR = "commonj.sdo.Boolean"; + + public static final Type BOOLEANOBJECT = TYPE_HELPER.getType("commonj.sdo", "BooleanObject"); + public static final String BOOLEANOBJECT_STR = "commonj.sdo.BooleanObject"; + + public static final Type BYTE = TYPE_HELPER.getType("commonj.sdo", "Byte"); + public static final String BYTE_STR = "commonj.sdo.Byte"; + + public static final Type BYTEOBJECT = TYPE_HELPER.getType("commonj.sdo", "ByteObject"); + public static final String BYTEOBJECT_STR = "commonj.sdo.ByteObject"; + + public static final Type BYTES = TYPE_HELPER.getType("commonj.sdo", "Bytes"); + public static final String BYTES_STR = "commonj.sdo.Bytes"; + + public static final Type CHARACTER = TYPE_HELPER.getType("commonj.sdo", "Character"); + public static final String CHARACTER_STR = "commonj.sdo.Character"; + + public static final Type CHARACTEROBJECT = TYPE_HELPER.getType("commonj.sdo", "CharacterObject"); + public static final String CHARACTEROBJECT_STR = "commonj.sdo.CharacterObject"; + + public static final Type DATE = TYPE_HELPER.getType("commonj.sdo", "Date"); + public static final String DATE_STR = "commonj.sdo.Date"; + + public static final Type DATETIME = TYPE_HELPER.getType("commonj.sdo", "DateTime"); + public static final String DATETIME_STR = "commonj.sdo.DateTime"; + + public static final Type DAY = TYPE_HELPER.getType("commonj.sdo", "Day"); + public static final String DAY_STR = "commonj.sdo.Day"; + + public static final Type DECIMAL = TYPE_HELPER.getType("commonj.sdo", "Decimal"); + public static final String DECIMAL_STR = "commonj.sdo.Decimal"; + + public static final Type DOUBLE = TYPE_HELPER.getType("commonj.sdo", "Double"); + public static final String DOUBLE_STR = "commonj.sdo.Double"; + + public static final Type DOUBLEOBJECT = TYPE_HELPER.getType("commonj.sdo", "DoubleObject"); + public static final String DOUBLEOBJECT_STR = "commonj.sdo.DoubleObject"; + + public static final Type DURATION = TYPE_HELPER.getType("commonj.sdo", "Duration"); + public static final String DURATION_STR = "commonj.sdo.Duration"; + + public static final Type FLOAT = TYPE_HELPER.getType("commonj.sdo", "Float"); + public static final String FLOAT_STR = "commonj.sdo.Float"; + + public static final Type FLOATOBJECT = TYPE_HELPER.getType("commonj.sdo", "FloatObject"); + public static final String FLOATOBJECT_STR = "commonj.sdo.FloatObject"; + + public static final Type INT = TYPE_HELPER.getType("commonj.sdo", "Int"); + public static final String INT_STR = "commonj.sdo.Int"; + + public static final Type INTEGER = TYPE_HELPER.getType("commonj.sdo", "Integer"); + public static final String INTEGER_STR = "commonj.sdo.Integer"; + + public static final Type INTOBJECT = TYPE_HELPER.getType("commonj.sdo", "IntObject"); + public static final String INTOBJECT_STR = "commonj.sdo.IntObject"; + + public static final Type LONG = TYPE_HELPER.getType("commonj.sdo", "Long"); + public static final String LONG_STR = "commonj.sdo.Long"; + + public static final Type LONGOBJECT = TYPE_HELPER.getType("commonj.sdo", "LongObject"); + public static final String LONGOBJECT_STR = "commonj.sdo.LongObject"; + + public static final Type MONTH = TYPE_HELPER.getType("commonj.sdo", "Month"); + public static final String MONTH_STR = "commonj.sdo.Month"; + + public static final Type MONTHDAY = TYPE_HELPER.getType("commonj.sdo", "MonthDay"); + public static final String MONTHDAY_STR = "commonj.sdo.MonthDay"; + + public static final Type OBJECT = TYPE_HELPER.getType("commonj.sdo", "Object"); + public static final String OBJECT_STR = "commonj.sdo.Object"; + + public static final Type SHORT = TYPE_HELPER.getType("commonj.sdo", "Short"); + public static final String SHORT_STR = "commonj.sdo.Short"; + + public static final Type SHORTOBJECT = TYPE_HELPER.getType("commonj.sdo", "ShortObject"); + public static final String SHORTOBJECT_STR = "commonj.sdo.ShortObject"; + + public static final Type STRING = TYPE_HELPER.getType("commonj.sdo", "String"); + public static final String STRING_STR = "commonj.sdo.String"; + + public static final Type STRINGS = TYPE_HELPER.getType("commonj.sdo", "Strings"); + public static final String STRINGS_STR = "commonj.sdo.Strings"; + + public static final Type TIME = TYPE_HELPER.getType("commonj.sdo", "Time"); + public static final String TIME_STR = "commonj.sdo.Time"; + + public static final Type URI = TYPE_HELPER.getType("commonj.sdo", "URI"); + public static final String URI_STR = "commonj.sdo.URI"; + + public static final Type YEAR = TYPE_HELPER.getType("commonj.sdo", "Year"); + public static final String YEAR_STR = "commonj.sdo.Year"; + + public static final Type YEARMONTH = TYPE_HELPER.getType("commonj.sdo", "YearMonth"); + public static final String YEARMONTH_STR = "commonj.sdo.YearMonth"; + + public static final Type YEARMONTHDAY = TYPE_HELPER.getType("commonj.sdo", "YearMonthDay"); + public static final String YEARMONTHDAY_STR = "commonj.sdo.YearMonthDay"; +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SPCommandImpl.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SPCommandImpl.java new file mode 100644 index 0000000000..c1822c3e07 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SPCommandImpl.java @@ -0,0 +1,100 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.Iterator; +import java.util.List; + +import org.apache.log4j.Logger; +import org.apache.tuscany.das.rdb.config.Parameter; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; + +import commonj.sdo.DataObject; +import commonj.sdo.Type; +import commonj.sdo.helper.TypeHelper; + +public class SPCommandImpl extends ReadCommandImpl { + private final Logger logger = Logger.getLogger(SPCommandImpl.class); + + public SPCommandImpl(String sqlString, MappingWrapper config, List params) { + super(sqlString, config, null); + Iterator i = params.iterator(); + while (i.hasNext()) { + 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); + + String direction = ParameterExtendedImpl.IN; + if (ParameterExtendedImpl.OUT.equalsIgnoreCase(p.getDirection())) { + direction = ParameterExtendedImpl.OUT; + } else if (ParameterExtendedImpl.IN_OUT.equalsIgnoreCase(p.getDirection())) { + direction = ParameterExtendedImpl.IN_OUT; + } + parameters.findOrCreateParameterWithIndex(p.getIndex(), direction, sdoType); + } + + } + + public DataObject executeQuery() { + + boolean success = false; + try { + List results = statement.executeCall(parameters); + success = true; + + return buildGraph(results); + } catch (SQLException e) { + if (this.logger.isDebugEnabled()) { + this.logger.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/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Statement.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Statement.java new file mode 100644 index 0000000000..bae802a2bc --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Statement.java @@ -0,0 +1,233 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +import org.apache.log4j.Logger; + +// TODO - Can use some refactoring. Much code is duplicated in "execute" methods +public class Statement { + + protected final String queryString; + + protected ConnectionImpl jdbcConnection; + + private final Logger logger = Logger.getLogger(Statement.class); + + private PreparedStatement preparedStatement; + + private boolean isPaging; + + public Statement(String sqlString) { + this.queryString = sqlString; + } + + public List executeQuery(ParametersExtendedImpl parameters) throws SQLException { + + PreparedStatement ps = getPreparedStatement(new String[0]); + ps = setParameters(ps, parameters); + ResultSet rs = ps.executeQuery(); + + return Collections.singletonList(rs); + } + + public List executeCall(ParametersExtendedImpl parameters) throws SQLException { + + CallableStatement cs = jdbcConnection.prepareCall(queryString); + + Iterator inParams = parameters.getInParameters().iterator(); + while (inParams.hasNext()) { + ParameterExtendedImpl param = (ParameterExtendedImpl) inParams.next(); + cs.setObject(param.getIndex(), param.getValue()); + } + + // register out parameters + Iterator outParams = parameters.getOutParameters().iterator(); + while (outParams.hasNext()) { + ParameterExtendedImpl param = (ParameterExtendedImpl) outParams.next(); + if (this.logger.isDebugEnabled()) { + this.logger.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(); + List results = new ArrayList(); + results.add(cs.getResultSet()); + while (cs.getMoreResults(java.sql.Statement.KEEP_CURRENT_RESULT)) { + results.add(cs.getResultSet()); + } + + Iterator i = parameters.getOutParameters().iterator(); + while (i.hasNext()) { + ParameterExtendedImpl param = (ParameterExtendedImpl) i.next(); + param.setValue(cs.getObject(param.getIndex())); + } + + return results; + + } + + public void executeUpdateCall(ParametersExtendedImpl parameters) throws SQLException { + CallableStatement cs = jdbcConnection.prepareCall(queryString); + + Iterator inParams = parameters.getInParameters().iterator(); + while (inParams.hasNext()) { + ParameterExtendedImpl param = (ParameterExtendedImpl) inParams.next(); + cs.setObject(param.getIndex(), param.getValue()); + } + + // register out parameters + Iterator outParams = parameters.getOutParameters().iterator(); + while (outParams.hasNext()) { + ParameterExtendedImpl param = (ParameterExtendedImpl) outParams.next(); + + if (this.logger.isDebugEnabled()) { + this.logger.debug("Registering parameter " + param.getName()); + } + + cs.registerOutParameter(param.getIndex(), SDODataTypeHelper.sqlTypeFor(param.getType())); + } + + cs.execute(); + + Iterator out = parameters.getOutParameters().iterator(); + while (out.hasNext()) { + ParameterExtendedImpl param = (ParameterExtendedImpl) out.next(); + param.setValue(cs.getObject(param.getIndex())); + } + + } + + public int executeUpdate(ParametersExtendedImpl parameters, String[] generatedKeys) throws SQLException { + return executeUpdate(getPreparedStatement(generatedKeys), parameters); + } + + public int executeUpdate(ParametersExtendedImpl parameters) throws SQLException { + return executeUpdate(parameters, new String[0]); + } + + /** + * TODO - We need to look at using specific ps.setXXX methods when a type + * has been specified and try setObject otherwise. + */ + private int executeUpdate(PreparedStatement ps, ParametersExtendedImpl parameters) throws SQLException { + if (this.logger.isDebugEnabled()) { + this.logger.debug("Executing statement " + queryString); + } + + Iterator i = parameters.getInParameters().iterator(); + while (i.hasNext()) { + ParameterExtendedImpl param = (ParameterExtendedImpl) i.next(); + + Object value = param.getValue(); + if (this.logger.isDebugEnabled()) { + this.logger.debug("Setting parameter " + param.getIndex() + " to " + value); + } + + if (value == null) { + if (param.getType() == null) { + try { + ParameterMetaData pmd = ps.getParameterMetaData(); + ps.setNull(param.getIndex(), pmd.getParameterType(param.getIndex())); + } catch (SQLException ex) { + ps.setNull(param.getIndex(), SDODataTypeHelper.sqlTypeFor(null)); + } + } else { + ps.setNull(param.getIndex(), SDODataTypeHelper.sqlTypeFor(param.getType())); + } + } else { + ps.setObject(param.getIndex(), value); + } + } + return ps.executeUpdate(); + } + + protected PreparedStatement setParameters(PreparedStatement ps, ParametersExtendedImpl parameters) throws SQLException { + Iterator i = parameters.getInParameters().iterator(); + while (i.hasNext()) { + ParameterExtendedImpl param = (ParameterExtendedImpl) i.next(); + 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(String[] returnKeys) throws SQLException { + + if (preparedStatement == null) { + if (isPaging) { + preparedStatement = jdbcConnection.preparePagedStatement(queryString); + } else { + preparedStatement = jdbcConnection.prepareStatement(queryString, returnKeys); + } + } + + return preparedStatement; + } + + public Integer getGeneratedKey() throws SQLException { + + if (getConnection().isGeneratedKeysSupported()) { + ResultSet rs = preparedStatement.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/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateCommandImpl.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateCommandImpl.java new file mode 100644 index 0000000000..4155360341 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateCommandImpl.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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(org.apache.tuscany.das.rdb.config.Command command) { + super(command); + } + + public UpdateCommandImpl(String sqlString) { + super(sqlString); + } + + public UpdateCommandImpl(Update update) { + super(update.getSql()); + this.addParameters(update.getParameters()); + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateList.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateList.java new file mode 100644 index 0000000000..e7bb58698c --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateList.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.List; + +/** + * Updates don't have to be sorted, so this class is a simple wrapper of ArrayList. + * + */ +public class UpdateList { + + private List updates = new ArrayList(); + + public UpdateList() { + super(); + } + + public void add(ChangeOperation c) { + updates.add(c); + } + + public Collection getSortedList() { + return updates; + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateOperation.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateOperation.java new file mode 100644 index 0000000000..1bcf3441b6 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateOperation.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/WriteCommandImpl.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/WriteCommandImpl.java new file mode 100644 index 0000000000..ee3f3d8faa --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/WriteCommandImpl.java @@ -0,0 +1,165 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.OutputStream; +import java.sql.SQLException; +import java.util.List; +import java.util.TreeMap; + +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.Parameters; +import org.apache.tuscany.das.rdb.config.ResultDescriptor; +import org.apache.tuscany.das.rdb.config.impl.ParameterImpl; + +import commonj.sdo.DataObject; + +public abstract class WriteCommandImpl extends CommandImpl { + + public WriteCommandImpl(org.apache.tuscany.das.rdb.config.Command command) { + super(command); + } + + public WriteCommandImpl(String sqlString) { + super(sqlString); + } + + public void setResultDescriptors(List resultDescriptorList){ + //ignore , applicable for ReadCommand only + } + + public List getResultDescriptors(){ + //ignore, applicable for ReadCommand only + return null; + } + + public void addResultDescriptor(ResultDescriptor resultDescriptor){ + //ignore + } + + + public ResultDescriptor removeResultDescriptor(int index){ + return null; + } + + public ResultDescriptor removeResultDescriptor(ResultDescriptor resultDescriptor){ + return null; + } + + public ResultDescriptor getResultDescriptor(int index){ + return null; + } + + public void printResultDescriptors(OutputStream ostrm) throws IOException{ + //ignore + } + + public void execute() { + + boolean success = false; + try { + basicExecute(); + success = true; + } finally { + if (success) { + statement.getConnection().cleanUp(); + } else { + statement.getConnection().errorCleanUp(); + } + } + + } + + public void basicExecute() { + try { + statement.executeUpdate(parameters); + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + public DataObject executeQuery() { + throw new UnsupportedOperationException(); + } + + public Config getMappingModel() { + return configWrapper.getConfig(); + } + + 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"); + } + + //it is acceptable if params having index set by caller are listed in any order in Parameters + //but, if index is not set by caller, the order of parameters in Parameters should be in sync + //with the Command string parameters + protected void addParameters(Parameters parameters) { + List params = parameters.getParameter(); + if(params == null) + return; + + boolean paramsIndexed = true; + TreeMap sortedParams = null; + for(int i=0; i -1) { + primaryGraph = (DataObject)graphs.remove(primaryIndex); + } + + Iterator i = graphs.iterator(); + if(primaryGraph == null) { + if (i.hasNext()) { + primaryGraph = (DataObject)i.next(); + } + } + + while (i.hasNext()) { + primaryGraph = merge(primaryGraph, (DataObject) i.next(), preservePrimaryChangeSummary); + } + + return primaryGraph; + } + + public DataObject merge(List graphs) { + return merge(graphs, true); + } + + public DataObject merge(DataObject primary, DataObject secondary, boolean preservePrimaryChangeSummary) { + Type rootType = createDataGraphRoot(); + DataObject root1 = null; + DataObject root2 = null; + + if(!isContainedWithChangeSummary(primary) && isContainedWithChangeSummary(secondary)) { + //swap as secondary has change history + DataObject temp = primary; + primary = secondary; + secondary = temp; + } + + //if primary top type name is not DataGraphRoot , add it + if(!isContainedWithChangeSummary(primary)) { + root1 = containWithChangeSummary(rootType, primary); + } else { + root1 = primary; + } + + //if secondary top type name is not DataGraphRoot , add it + if(!isContainedWithChangeSummary(secondary)) { + root2 = containWithChangeSummary(rootType, secondary); + } else { + root2 = secondary; + } + + return mergeContained(root1, root2, preservePrimaryChangeSummary); + } + + public DataObject merge(DataObject primary, DataObject secondary) { + return merge(primary, secondary, true); + } + + public DataObject mergeContained(DataObject primary, DataObject secondary, boolean preservePrimaryChangeSummary) { + addGraphToRegistry(primary); + + Iterator i = secondary.getType().getProperties().iterator(); + ChangeSummary summary = primary.getDataGraph().getChangeSummary(); + + if(preservePrimaryChangeSummary && summary.isLogging()) { + summary.endLogging(); + } + + 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); + } + } + + if(preservePrimaryChangeSummary && !summary.isLogging()) { + summary.beginLogging(); + } + + return primary; + } + + private void createObjectWithSubtree(DataObject root, Property p, DataObject object) { + Object pk = getPrimaryKey(object); + + if (!registry.contains(object.getType().getName(), Collections.singletonList(pk))) { + Iterator attrs = object.getType().getProperties().iterator(); + DataObject newObject = root.createDataObject(p.getName()); + + createDataProperties(attrs, newObject, object); + registry.put(object.getType().getName(), Collections.singletonList(pk), newObject); + createReferenceProperties(root, newObject, object); + } + + } + + private void createDataProperties(Iterator attrs, DataObject newObject, DataObject object) { + while (attrs.hasNext()) { + Property attr = (Property) attrs.next(); + if (attr.getType().isDataType()) { + try { + newObject.set(attr.getName(), object.get(attr)); + } catch(Exception e) { + throw new RuntimeException("Graph structures do not match, can not merge! " + attr.getName()); + } + } + } + } + + private void createReferenceProperties(DataObject root, DataObject newObject, DataObject object) { + 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)); + if (logger.isDebugEnabled()) { + logger.debug("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()); + } + + //JIRA-952 + //if the table and column have SDO type name and property name use it else use database table and column name + public void addPrimaryKey(String key) { + QualifiedColumn column = null; + if(this.config != null && this.config.isDatabaseSchemaNameSupported()){ + column = new QualifiedColumn(key, this.config.isDatabaseSchemaNameSupported()); + } + else{ + column = new QualifiedColumn(key); + } + + String tableName = column.getTableName(); + String columnName = column.getColumnName(); + String schemaName = column.getSchemaName(); + String qualifiedTableName = null; + + if(this.config != null && this.config.isDatabaseSchemaNameSupported()) { + qualifiedTableName = schemaName+"."+tableName; + } else { + qualifiedTableName = tableName; + } + MappingWrapper configWrapper = new MappingWrapper(this.config); + + String typeName = configWrapper.getTableTypeName(qualifiedTableName); + String propertyName = configWrapper.getColumnPropertyName(qualifiedTableName, columnName); + + if(typeName != null && propertyName != null) { + if (logger.isDebugEnabled()) { + logger.debug("Adding " + typeName + " " + propertyName + " to keys"); + } + keys.put(typeName, propertyName); + } else { + if (logger.isDebugEnabled()) { + logger.debug("Adding " + column.getTableName() + " " + column.getColumnName() + " to keys"); + } + keys.put(column.getTableName(), column.getColumnName()); + } + } +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/util/CollectionsUtil.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/util/CollectionsUtil.java new file mode 100644 index 0000000000..64e8826f76 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/util/CollectionsUtil.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.Collection; +import java.util.Iterator; + +/** + */ +public final class CollectionsUtil { + + private CollectionsUtil() { + + } + + // Utilities + public static boolean disjoint(Collection c1, Collection c2) { + + if (c1.size() > c2.size()) { + Collection c = c1; + c1 = c2; + c2 = c; + } + for (Iterator iterator = c2.iterator(); iterator.hasNext();) { + Object o = (Object)iterator.next(); + if (c1.contains(o)) { + return false; + } + } + return true; + } + +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/util/ConfigUtil.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/util/ConfigUtil.java new file mode 100644 index 0000000000..c5c7a38aab --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/util/ConfigUtil.java @@ -0,0 +1,130 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 java.util.Iterator; +import java.util.List; + +import org.apache.tuscany.das.rdb.config.Command; +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.ConfigFactory; +import org.apache.tuscany.das.rdb.config.Create; +import org.apache.tuscany.das.rdb.config.Delete; +import org.apache.tuscany.das.rdb.config.Parameter; +import org.apache.tuscany.das.rdb.config.Update; + +import commonj.sdo.helper.HelperContext; +import commonj.sdo.helper.XMLHelper; +import commonj.sdo.impl.HelperProvider; + +/** + * Config util provides config-related utilities such as loading a Config + * instance from an InputStream + * + */ +public final class ConfigUtil { + + private 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"); + } + + HelperContext context = HelperProvider.getDefaultContext(); + ConfigFactory.INSTANCE.register(context); + XMLHelper helper = context.getXMLHelper(); + + try { + return (Config) helper.load(configStream).getRootObject(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public static String getParameters(Create createCommand) { + List parameters = createCommand.getParameters().getParameter(); + if(parameters != null) { + Iterator itr = parameters.iterator(); + StringBuffer serializedParameters = new StringBuffer(); + + while(itr.hasNext()) { + serializedParameters.append(((Parameter)itr.next()).getName()+" "); + } + return serializedParameters.toString().trim(); + } + else { + return null; + } + } + + public static String getParameters(Update updateCommand) { + List parameters = updateCommand.getParameters().getParameter(); + if(parameters != null) { + Iterator itr = parameters.iterator(); + StringBuffer serializedParameters = new StringBuffer(); + + while(itr.hasNext()) { + serializedParameters.append(((Parameter)itr.next()).getName()+" "); + } + return serializedParameters.toString().trim(); + } + else { + return null; + } + } + + public static String getParameters(Delete deleteCommand) { + List parameters = deleteCommand.getParameters().getParameter(); + if(parameters != null) { + Iterator itr = parameters.iterator(); + StringBuffer serializedParameters = new StringBuffer(); + + while(itr.hasNext()) { + serializedParameters.append(((Parameter)itr.next()).getName()+" "); + } + return serializedParameters.toString().trim(); + } + else { + return null; + } + } + + public static String getParameters(Command command) { + List parameters = command.getParameter(); + if(parameters != null) { + Iterator itr = parameters.iterator(); + StringBuffer serializedParameters = new StringBuffer(); + + while(itr.hasNext()) { + serializedParameters.append(((Parameter)itr.next()).getName()+" "); + } + return serializedParameters.toString().trim(); + } + else { + return null; + } + } +} diff --git a/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DataObjectUtil.java b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DataObjectUtil.java new file mode 100644 index 0000000000..b9649669e5 --- /dev/null +++ b/das-java/trunk/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DataObjectUtil.java @@ -0,0 +1,79 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 final class DataObjectUtil { + + private 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/das-java/trunk/rdb/src/main/resources/META-INF/DISCLAIMER b/das-java/trunk/rdb/src/main/resources/META-INF/DISCLAIMER new file mode 100644 index 0000000000..a65af91c5a --- /dev/null +++ b/das-java/trunk/rdb/src/main/resources/META-INF/DISCLAIMER @@ -0,0 +1,7 @@ +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache 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. \ No newline at end of file diff --git a/das-java/trunk/rdb/src/main/resources/META-INF/LICENSE b/das-java/trunk/rdb/src/main/resources/META-INF/LICENSE new file mode 100644 index 0000000000..9597d92eb3 --- /dev/null +++ b/das-java/trunk/rdb/src/main/resources/META-INF/LICENSE @@ -0,0 +1,353 @@ + + 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. + +=============================================================================================================== + +Other components and dependencies under Apache Software License 2.0 : + + log4j-1.2.14.jar - Apache Logging Services + derby 10.2.2.0.jar - Apache Derby + stax-api-1.0.1.jar - The Streaming API for XML (StAX) + wstx-asl-3.2.0.jar - WoodStox StAX implementation + standard-1.1.1.jar - The Apache Jackarta Taglibs + jstl-1.1.2.jar - The Apache Jackarta Taglibs + *.tld - The Apache Jackarta Taglibs + +=============================================================================================================== + + +Apache Tuscany SDO for Java Subcomponents +=========================================: + +The Tuscany SDO for Java release 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. + +License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar) + +Permission to copy, make derivative works of, and distribute the Service Data Objects +JavaDoc and Interface Definition Files files in any medium without fee or royalty as part +of a compliant implementation of the Service Data Objects Specification is hereby granted. +The Service Data Objects Specification may be found at any of the following locations: + +http://dev2dev.bea.com/technologies/commonj/index.jsp +http://www.ibm.com/developerworks/library/specification/ws-sdo/ +http://oracle.com/technology/webservices/sca +https://www.sdn.sap.com/ +http://www.xcalia/xdn/specs/sdo + +THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES +ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS +SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS, +INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE +SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES. + +The name and trademarks of the Authors may NOT be used in any manner, including advertising or +publicity pertaining to the Service Component Architecture Specification or its contents without specific, +written prior permission. Title to copyright in the Service Data Objects Specification and the +JavaDoc and Interface Definition Files will at all times remain with the Authors. + +No other rights are granted by implication, estoppel or otherwise. + +================================================================================================================= + +For the Eclipse EMF components +(codegen-2.2.3.jar +codegen-ecore-2.2.3.jar +common-2.2.3.jar +ecore-2.2.3.jar +ecore-change-2.2.3.jar +ecore-xmi-2.2.3.jar +xsd-2.2.3.jar) + +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. + +=================================================================================================== diff --git a/das-java/trunk/rdb/src/main/resources/META-INF/NOTICE b/das-java/trunk/rdb/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..e9d98fc7f5 --- /dev/null +++ b/das-java/trunk/rdb/src/main/resources/META-INF/NOTICE @@ -0,0 +1,32 @@ +Apache Tuscany SDO for Java +Copyright 2006, 2007 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF), +sponsored by the Apache 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. + +Unless otherwise indicated, all distribution made available by the Apache Software Foundation +is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL"). +A copy of the AL is provided with this distribution as the LICENSE.txt file present in the +root directory, and is also available at http://www.apache.org/licenses/. + +The terms and conditions governing the distribution may refer to the AL or other license +agreements, notices or terms and conditions. Some of these other license agreements may +include (but are not limited to): + + . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html) + +It is your obligation to read and accept all such terms and conditions prior to use of the +distribution. If term or condition is provided, please contact the Apache Software Foundation +to determine what terms and conditions govern that particular distribution. + +This product also includes software developed by the Open Service Oriented Architecture organisation +(http://osoa.org). The license for this software may be found in the LICENSE.txt file contained in this +distribution. diff --git a/das-java/trunk/rdb/src/main/resources/META-INF/README b/das-java/trunk/rdb/src/main/resources/META-INF/README new file mode 100644 index 0000000000..853d9546db --- /dev/null +++ b/das-java/trunk/rdb/src/main/resources/META-INF/README @@ -0,0 +1,35 @@ +Apache Tuscany DAS beta1 build (June, 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/das-java/trunk/rdb/src/main/resources/config.xsd b/das-java/trunk/rdb/src/main/resources/config.xsd new file mode 100644 index 0000000000..e48d01ed2a --- /dev/null +++ b/das-java/trunk/rdb/src/main/resources/config.xsd @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/das-java/trunk/rdb/src/main/resources/dasmodel4.mdl b/das-java/trunk/rdb/src/main/resources/dasmodel4.mdl new file mode 100644 index 0000000000..476974975b --- /dev/null +++ b/das-java/trunk/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/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/AliasTests.java b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/AliasTests.java new file mode 100644 index 0000000000..eca81623d8 --- /dev/null +++ b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/AliasTests.java @@ -0,0 +1,186 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.BookData; +import org.apache.tuscany.das.rdb.test.data.CustomerData; +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(); + new CustomerData(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(); + bookToChange = null; + Iterator i = root.getList("Book").iterator(); + while (i.hasNext()) { + DataObject d = (DataObject) i.next(); + if ("Fyodor Dostoevskii".equals(d.getString("Writer"))) { + bookToChange = d; + } + } + assertFalse(bookToChange == null); + + 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")); + } + + /** + * 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")); + + } + + /** + * Test modify PK value + */ + public void testModifyPK() 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")); + + customer.setInt("id", 100); + das.applyChanges(root); + + select = das.createCommand("SELECT * FROM CUSTOMER WHERE CUSTOMER.ID = 100"); + root = select.executeQuery(); + customer = root.getDataObject("Customer[1]"); + assertEquals(100, customer.getInt("id")); + } +} diff --git a/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/BestPracticeTests.java b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/BestPracticeTests.java new file mode 100644 index 0000000000..3a7c4560cb --- /dev/null +++ b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/BestPracticeTests.java @@ -0,0 +1,153 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 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(); + + Iterator i = root.getList("COMPANY").iterator(); + while (i.hasNext()) { + DataObject d = (DataObject) i.next(); + List departments = d.getList("departments"); + if (d.getString("NAME").equals("Do-rite plumbing") || d.getString("NAME").equals("ACME Publishing")) { + assertEquals(0, departments.size()); + } else { + assertEquals(1, 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("DEPNUMBER", "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/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CUDGeneration.java b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CUDGeneration.java new file mode 100644 index 0000000000..60b0d05ead --- /dev/null +++ b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CUDGeneration.java @@ -0,0 +1,111 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CheckSupportGeneratedKeys.java b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CheckSupportGeneratedKeys.java new file mode 100644 index 0000000000..8e3c983e63 --- /dev/null +++ b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CheckSupportGeneratedKeys.java @@ -0,0 +1,167 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.config.Config; +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.framework.DasTest; + +import commonj.sdo.DataObject; + +public class CheckSupportGeneratedKeys extends DasTest { + protected void setUp() throws Exception { + super.setUp(); + + new CustomerData(getAutoConnection()).refresh();//no generated keys used + new CompanyData(getAutoConnection()).refresh();//generated keys used + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + // useGetGeneratedKeys set to TRUE - Company + public void testInsert() throws Exception { + ConfigHelper helper = new ConfigHelper(); + Config config = helper.getConfig(); + config.setGeneratedKeysSupported("true"); + + DAS das = DAS.FACTORY.createDAS(config, getConnection()); + Command insert = das.createCommand("insert into COMPANY (NAME) values (?)"); + insert.setParameter(1, "AAA Rental"); + insert.execute(); + Integer key = new 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")); + } + + // useGetGeneratedKeys not set - Company (should work as default TRUE) + public void testInsert1() throws Exception { + ConfigHelper helper = new ConfigHelper(); + Config config = helper.getConfig(); + + DAS das = DAS.FACTORY.createDAS(config, getConnection()); + Command insert = das.createCommand("insert into COMPANY (NAME) values (?)"); + insert.setParameter(1, "AAA Rental"); + insert.execute(); + Integer key = new 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")); + } + + // useGetGeneratedKeys set to FALSE - Company - + // exception as insert.getGen..Keys will throw RuntimeException + public void testInsert2() throws Exception { + ConfigHelper helper = new ConfigHelper(); + Config config = helper.getConfig(); + config.setGeneratedKeysSupported("false"); + + DAS das = DAS.FACTORY.createDAS(config, getConnection()); + Command insert = das.createCommand("insert into COMPANY (NAME) values (?)"); + insert.setParameter(1, "AAA Rental"); + insert.execute();//this will happen as table is created with proper clause + + try{ + Integer key = new Integer(insert.getGeneratedKey()); + fail("Should not be able to retrieve key "+key);//unexpected + }catch(RuntimeException e){ + //e.printStackTrace(); + assertTrue(true);//expected + } + } + + // useGetGeneratedKeys set to TRUE - Customer - flag should be ignored during insert + public void testInsert3() throws Exception { + ConfigHelper helper = new ConfigHelper(); + Config config = helper.getConfig(); + config.setGeneratedKeysSupported("true"); + + DAS das = DAS.FACTORY.createDAS(config, getConnection()); + Command insert = das.createCommand("insert into CUSTOMER (ID, LASTNAME, ADDRESS) values (?, ?, ?)"); + String key = "10"; + insert.setParameter(1, key); + insert.setParameter(2, "CUST10"); + insert.setParameter(3, "ADDR10"); + insert.execute(); + + // Verify insert + Command select = das.createCommand("Select ID, LASTNAME from CUSTOMER where ID = ?"); + select.setParameter(1, key); + DataObject root = select.executeQuery(); + assertEquals(key, root.get("CUSTOMER[1]/ID").toString()); + } + + // useGetGeneratedKeys set to FALSE - Customer, flag has no effect + public void testInsert4() throws Exception { + ConfigHelper helper = new ConfigHelper(); + Config config = helper.getConfig(); + config.setGeneratedKeysSupported("false"); + + DAS das = DAS.FACTORY.createDAS(config, getConnection()); + Command insert = das.createCommand("insert into CUSTOMER (ID, LASTNAME, ADDRESS) values (?, ?, ?)"); + String key = "10"; + insert.setParameter(1, key); + insert.setParameter(2, "CUST10"); + insert.setParameter(3, "ADDR10"); + insert.execute(); + try{ + Integer retkey = new Integer(insert.getGeneratedKey()); + fail("Should not be able to retrieve key "+retkey); + }catch(RuntimeException e){ + //e.printStackTrace(); + assertTrue(true);//expected + } + + // Verify insert + Command select = das.createCommand("Select ID, LASTNAME from CUSTOMER where ID = ?"); + select.setParameter(1, key); + DataObject root = select.executeQuery(); + assertEquals(key, root.get("CUSTOMER[1]/ID").toString()); + } + + // useGetGeneratedKeys not set - Customer - default TRUE is ignored + public void testInsert5() throws Exception { + ConfigHelper helper = new ConfigHelper(); + Config config = helper.getConfig(); + + DAS das = DAS.FACTORY.createDAS(config, getConnection()); + Command insert = das.createCommand("insert into CUSTOMER (ID, LASTNAME, ADDRESS) values (?, ?, ?)"); + String key = "10"; + insert.setParameter(1, key); + insert.setParameter(2, "CUST10"); + insert.setParameter(3, "ADDR10"); + insert.execute(); + + // Verify insert + Command select = das.createCommand("Select ID, LASTNAME from CUSTOMER where ID = ?"); + select.setParameter(1, key); + DataObject root = select.executeQuery(); + assertEquals(key, root.get("CUSTOMER[1]/ID").toString()); + } +} diff --git a/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java new file mode 100644 index 0000000000..5e7bf3976f --- /dev/null +++ b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java @@ -0,0 +1,161 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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("CustomersOrdersConfig.xml"), getConnection()); + + Command read = das.getCommand("order by id"); + read.setParameter(1, new Integer(1)); + DataObject root = read.executeQuery(); + + assertEquals("recombobulator", root.getString("ANORDER[1]/PRODUCT")); + + } + + /** + * Specify connection properties in config. Add explicit update command + */ + public void testUpdate() throws Exception { + + DAS das = DAS.FACTORY.createDAS(getConfig("CustomersOrdersConfig.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/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java new file mode 100644 index 0000000000..65c2e86592 --- /dev/null +++ b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java @@ -0,0 +1,171 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 commonj.sdo.DataObject; +import commonj.sdo.helper.HelperContext; +import commonj.sdo.impl.HelperProvider; + +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.ID, COMPANY.NAME, " + + "EMPLOYEE.ID, EMPLOYEE.NAME, EMPLOYEE.SN, EMPLOYEE.MANAGER, " + + "DEPARTMENT.ID, DEPARTMENT.NAME, DEPARTMENT.LOCATION, DEPARTMENT.DEPNUMBER 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()); + HelperContext context = HelperProvider.getDefaultContext(); + CompanyFactory.INSTANCE.register(context); + // Build the select command + Command selectCommand = das.createCommand("select COMPANY.ID, COMPANY.NAME, " + + "EMPLOYEE.ID, EMPLOYEE.NAME, EMPLOYEE.SN, EMPLOYEE.MANAGER, " + + "DEPARTMENT.ID, DEPARTMENT.NAME, DEPARTMENT.LOCATION, DEPARTMENT.DEPNUMBER 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()); + } + + /** + * Default database setup inserts 3 records in COMPANY. This test verifies that these records have auto-gen keys + * 1,2,3 and the new created record has auto-gen key 4 in COMPANY.ID + * @throws Exception + */ + public void testCreateAutoGenKeyStatic() throws Exception { + //get DAS and select command + DataObject root = null; + + DAS das = DAS.FACTORY.createDAS(getConfig("companyMappingWithConverters.xml"), getConnection()); + HelperContext context = HelperProvider.getDefaultContext(); + CompanyFactory.INSTANCE.register(context); + Command selectCommand = das.getCommand("AllCompanies"); + root = selectCommand.executeQuery(); + assertEquals(3, root.getList("CompanyType").size()); + //verify result + CompanyType company = (CompanyType) root.getList("CompanyType").get(0); + int startId = company.getId(); + assertEquals(startId, company.getId()); + assertEquals("ACME Publishing", company.getName()); + + company = (CompanyType) root.getList("CompanyType").get(1); + assertEquals(startId+1, company.getId()); + assertEquals("Do-rite plumbing", company.getName()); + + company = (CompanyType) root.getList("CompanyType").get(2); + assertEquals(startId+2, company.getId()); + assertEquals("MegaCorp", company.getName()); + + //create a new company. auto get keys set in config and supported in table creation statement + CompanyType newCompany = (CompanyType)root.createDataObject("CompanyType"); + newCompany.setName("MyNewCompany"); + das.applyChanges(root); + + assertEquals("MyNewCompany", newCompany.getName()); + assertEquals(startId+3, newCompany.getId()); + } + + public void testCreateAutoGenKeyDynamic() throws Exception { + //get DAS and select command + DataObject root = null; + + DAS das = DAS.FACTORY.createDAS(getConfig("basicCompanyDepartmentMapping.xml"), getConnection()); + Command selectCommand = das.createCommand("select * from COMPANY"); + root = selectCommand.executeQuery(); + assertEquals(3, root.getList("COMPANY").size()); + //verify result + DataObject company = (DataObject)root.getList("COMPANY").get(0); + int startId = company.getInt("ID"); + assertEquals(startId, company.getInt("ID")); + assertEquals("ACME Publishing", company.getString("NAME")); + + company = (DataObject)root.getList("COMPANY").get(1); + assertEquals(startId+1, company.getInt("ID")); + assertEquals("Do-rite plumbing", company.getString("NAME")); + + company = (DataObject)root.getList("COMPANY").get(2); + assertEquals(startId+2, company.getInt("ID")); + assertEquals("MegaCorp", company.getString("NAME")); + + //create a new company. auto get keys set in config and supported in table creation statement + DataObject newCompany = root.createDataObject("COMPANY"); + newCompany.setString("NAME", "MyNewCompany"); + das.applyChanges(root); + + assertEquals("MyNewCompany", newCompany.getString("NAME")); + assertEquals(startId+3, newCompany.getInt("ID")); + } +} diff --git a/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyRelationshipTests.java b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyRelationshipTests.java new file mode 100644 index 0000000000..8bd3c2479a --- /dev/null +++ b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyRelationshipTests.java @@ -0,0 +1,265 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 java.util.Vector; + +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.config.Relationship; +import org.apache.tuscany.das.rdb.test.data.OrderDetailsData; +import org.apache.tuscany.das.rdb.test.data.OrderDetailsDescriptionData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; + +import commonj.sdo.DataObject; + +public class CompoundKeyRelationshipTests extends DasTest { + + protected void setUp() throws Exception { + super.setUp(); + + //new OrderData(getAutoConnection()).refresh(); + //new ProductData(getAutoConnection()).refresh(); + new OrderDetailsData(getAutoConnection()).refresh(); + new OrderDetailsDescriptionData(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 ORDERDETAILS LEFT JOIN ORDERDETAILSDESC " + + "ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID AND " + + " ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID " + + " WHERE ORDERDETAILS.ORDERID = 1 AND ORDERDETAILS.PRODUCTID = 1"; + + DAS das = DAS.FACTORY.createDAS(getConfig("OrderDetailsAndDescription.xml"), getConnection()); + // Read some order details and related order details description + Command select = das.createCommand(statement); + + DataObject root = select.executeQuery(); + DataObject orderdetails = root.getDataObject("ORDERDETAILS[1]"); + + assertEquals(2, orderdetails.getList("orderDetailsDesc").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("OrderDetailsAndDescription.xml"), getConnection()); + // Read some order details and related order details descs + Command select = das + .createCommand("SELECT * FROM ORDERDETAILS LEFT JOIN ORDERDETAILSDESC ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID " + + " AND ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID"); + + DataObject root = select.executeQuery(); + + DataObject ordDet1 = root.getDataObject("ORDERDETAILS[1]"); + DataObject ordDet2 = root.getDataObject("ORDERDETAILS[2]"); + + // Save IDs + Integer ord1ID = (Integer) ordDet1.get("ORDERID"); + Integer prod1ID = (Integer) ordDet1.get("PRODUCTID"); + + Integer ord2ID = (Integer) ordDet2.get("ORDERID"); + Integer prod2ID = (Integer) ordDet2.get("PRODUCTID"); + + // save order count + Integer order1DetDescCount = new Integer(ordDet1.getList("orderDetailsDesc").size()); + Integer order2DetDescCount = new Integer(ordDet2.getList("orderDetailsDesc").size()); + + // Move an order detail desc to ord det1 from ord det2 + DataObject orderDetailsDesc = (DataObject) ordDet2.getList("orderDetailsDesc").get(0); + ordDet1.getList("orderDetailsDesc").add(orderDetailsDesc); + + // Flush changes + das.applyChanges(root); + + // verify ord det1 relationship updates + select = das + .createCommand("SELECT * FROM ORDERDETAILS LEFT JOIN ORDERDETAILSDESC ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID " + + " AND ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID where ORDERDETAILS.ORDERID = ? AND ORDERDETAILS.PRODUCTID = ?"); + select.setParameter(1, ord1ID); + select.setParameter(2, prod1ID); + + root = select.executeQuery(); + assertEquals(order1DetDescCount.intValue() + 1, root.getList("ORDERDETAILS[1]/orderDetailsDesc").size()); + + // verify ord det2 relationship updates + select.setParameter(1, ord2ID); + select.setParameter(2, prod2ID); + + root = select.executeQuery(); + assertEquals(order2DetDescCount.intValue() - 1, root.getList("ORDERDETAILS[1]/orderDetailsDesc").size()); + } + + public void testFKBehavior() throws SQLException { + DAS das = DAS.FACTORY.createDAS(getConfig("OrderDetailsAndDescription.xml"), getConnection()); + // Read some order details and related order details descs + Command select = das + .createCommand("SELECT * FROM ORDERDETAILS LEFT JOIN ORDERDETAILSDESC ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID " + + " AND ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID"); + + DataObject root = select.executeQuery(); + + DataObject ordDet1 = root.getDataObject("ORDERDETAILS[1]"); + DataObject ordDet2 = root.getDataObject("ORDERDETAILS[2]"); + + // Save IDs + Integer ord1ID = (Integer) ordDet1.get("ORDERID"); + Integer prod1ID = (Integer) ordDet1.get("PRODUCTID"); + + // Move an order det desc to ord det1 from ord det2 + DataObject orderDetDesc = (DataObject) ordDet2.getList("orderDetailsDesc").get(0); + ordDet1.getList("orderDetailsDesc").add(orderDetDesc); + orderDetDesc.setInt("ORDERID", ord1ID.intValue()); + + try { + das.applyChanges(root); + fail("An exception should be thrown"); + } catch (RuntimeException ex) { + assertEquals("Foreign key properties should not be set when the corresponding relationship has changed", ex.getMessage()); + } + + } + + public void testFKBehavior2() throws SQLException { + DAS das = DAS.FACTORY.createDAS(getConfig("OrderDetailsAndDescription.xml"), getConnection()); + // Read some order details and related order details descs + Command select = das + .createCommand("SELECT * FROM ORDERDETAILS LEFT JOIN ORDERDETAILSDESC ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID " + + " AND ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID"); + + DataObject root = select.executeQuery(); + + DataObject ordDet1 = root.getDataObject("ORDERDETAILS[1]"); + DataObject ordDet2 = root.getDataObject("ORDERDETAILS[2]"); + + // Save IDs + Integer ord1ID = (Integer) ordDet1.get("ORDERID"); + Integer prod1ID = (Integer) ordDet1.get("PRODUCTID"); + + // Create an order det desc for ord det1 + DataObject orderDetDesc = root.createDataObject("ORDERDETAILSDESC"); + orderDetDesc.setInt("ID", 500); + orderDetDesc.setInt("ORDERID", ord1ID.intValue()); + ordDet1.getList("orderDetailsDesc").add(orderDetDesc); + + try { + das.applyChanges(root); + fail("An exception should be thrown"); + } catch (RuntimeException ex) { + assertEquals("Foreign key properties should not be set when the corresponding relationship has changed", ex.getMessage()); + } + } + + //add relationship through config helper + public void testValidFKColumn() throws SQLException { + ConfigHelper helper = new ConfigHelper(); + Vector parentColumnNames = new Vector(); + Vector childColumnNames = new Vector(); + + parentColumnNames.add(0, "ORDERDETAILS.ORDERID"); + parentColumnNames.add(1, "ORDERDETAILS.PRODUCTID"); + + childColumnNames.add(0, "ORDERDETAILSDESC.ORDERID"); + childColumnNames.add(1, "ORDERDETAILSDESC.PRODUCTID"); + + Relationship r = helper.addRelationship(parentColumnNames, childColumnNames); + + DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection()); + Command select = das.createCommand("SELECT * FROM ORDERDETAILS LEFT JOIN ORDERDETAILSDESC ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID " + + " AND ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID"); + + DataObject root = select.executeQuery(); + DataObject ordDet1 = root.getDataObject("ORDERDETAILS[1]"); + int order1DetDescCount = ordDet1.getList("ORDERDETAILSDESC").size(); + + DataObject orderDetDesc = root.createDataObject("ORDERDETAILSDESC"); + orderDetDesc.setInt("ID", 500); + + if(ordDet1 == null) System.out.println("order det1 is null"); + if(ordDet1.getList("ORDERDETAILSDESC") == null)System.out.println("list is null"); + + ordDet1.getList("ORDERDETAILSDESC").add(orderDetDesc); + try { + das.applyChanges(root); + + select = das.createCommand("SELECT * FROM ORDERDETAILS LEFT JOIN ORDERDETAILSDESC ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID " + + " AND ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID"); + + int modOrder1DetDescCount = select.executeQuery(). + getDataObject("ORDERDETAILS[1]").getList("ORDERDETAILSDESC").size(); + this.assertEquals(modOrder1DetDescCount, order1DetDescCount+1); + } catch (RuntimeException ex) { + fail("Exception was not expected:DETAILS:"+ ex.getMessage()); + } + } + + //add invalid relationship through config helper using invalid FK column name + public void testInvalidFKColumn() throws SQLException { + ConfigHelper helper = new ConfigHelper(); + Vector parentColumnNames = new Vector(); + Vector childColumnNames = new Vector(); + + parentColumnNames.add(0, "ORDERDETAILS.ORDERID"); + parentColumnNames.add(1, "ORDERDETAILS.PRODUCTID"); + + childColumnNames.add(0, "ORDERDETAILSDESC.ORDERID_INVALID"); + childColumnNames.add(1, "ORDERDETAILSDESC.PRODUCTID"); + + Relationship r = helper.addRelationship(parentColumnNames, childColumnNames); + + DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection()); + Command select = das.createCommand("SELECT * FROM ORDERDETAILS LEFT JOIN ORDERDETAILSDESC ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID " + + " AND ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID"); + + DataObject root = select.executeQuery(); + DataObject ordDet1 = root.getDataObject("ORDERDETAILS[1]"); + int order1DetDescCount = ordDet1.getList("ORDERDETAILSDESC").size(); + + DataObject orderDetDesc = root.createDataObject("ORDERDETAILSDESC"); + orderDetDesc.setInt("ID", 500); + + if(ordDet1 == null) System.out.println("order det1 is null"); + if(ordDet1.getList("ORDERDETAILSDESC") == null)System.out.println("list is null"); + + ordDet1.getList("ORDERDETAILSDESC").add(orderDetDesc); + try { + das.applyChanges(root); + fail("Exception was expected"); + } catch (RuntimeException ex) { + assertEquals("Invalid foreign key column: ORDERID_INVALID", ex.getMessage()); + } + } +} diff --git a/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyTests.java b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyTests.java new file mode 100644 index 0000000000..db8a59e638 --- /dev/null +++ b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyTests.java @@ -0,0 +1,109 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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()); + + } + + public void testReadAndDelete() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConfig("OrdersOrderDetailsConfig.xml"), 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]"); + orderDetail.delete(); + das.applyChanges(root); + + } +} diff --git a/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConnectionTests.java b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConnectionTests.java new file mode 100644 index 0000000000..42ff57b831 --- /dev/null +++ b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConnectionTests.java @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 java.sql.Statement; +import java.util.Properties; + +import org.apache.derby.jdbc.EmbeddedDataSource; +import org.apache.tuscany.das.rdb.DAS; +import org.apache.tuscany.das.rdb.test.framework.DasTest; + +import commonj.sdo.DataObject; + +/** + * Test Database Connection with and without authentication required + */ +public class ConnectionTests extends DasTest { + Properties p = null; + + protected void setUp() throws Exception { + super.setUp(); + p = System.getProperties(); + p.put("derby.system.home", "target"); + + EmbeddedDataSource ds = new EmbeddedDataSource(); + ds.setDatabaseName("dastestcon"); + ds.setDataSourceName("java/dastestcon"); + ds.setCreateDatabase("create"); + ds.setUser("dasuser"); + ds.setPassword("dasuser"); + Connection connection = ds.getConnection("dasuser", "dasuser");//to actually create the database + Statement stmt = connection.createStatement(); + try{ + stmt.executeQuery("select * from BOOK"); + } catch(Exception e) { + stmt.execute("create table BOOK (id int, name varchar(30))"); + stmt.execute("insert into BOOK values (1, 'book1')"); + } + connection.commit(); + connection.close(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + /** + * As database is created with user, password, connection without same authentication can not look up data + */ + public void testConnectionUsingDriverManagerNoAuth() throws Exception { + try { + DAS das = DAS.FACTORY.createDAS(getConfig("connectionInfoDriverManagerNoAuth.xml")); + das.getCommand("getBook").executeQuery(); + fail("Expected exception, as DB is created with id, pwd, needs same to get data from DB!"); + } catch(Exception e) { + assertTrue(true);//Expected exception + } + } + + /** + * As database is created with user, password, connection with same authentication can look up data + */ + public void testConnectionUsingDriverManagerAuth() throws Exception { + try { + DAS das = DAS.FACTORY.createDAS(getConfig("connectionInfoDriverManagerAuth.xml")); + DataObject root = das.getCommand("getBook").executeQuery(); + assertEquals(1, root.getList("BOOK").size()); + } catch(Exception e) { + fail("Expected DAS to obtain authenticated connection using data source!"); + } + } +} diff --git a/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java new file mode 100644 index 0000000000..b300b85192 --- /dev/null +++ b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java @@ -0,0 +1,222 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.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 commonj.sdo.DataObject; +import commonj.sdo.helper.HelperContext; +import commonj.sdo.impl.HelperProvider; +/** + * Tests the Converter framwork + */ +public class ConverterTests extends DasTest { + + private static DateFormat myformat = new SimpleDateFormat("yyyy.MM.dd"); + + private static Date kbday; + + private static Date tbday; + + protected void setUp() throws Exception { + super.setUp(); + new CustomerData(getAutoConnection()).refresh(); + new OrderData(getAutoConnection()).refresh(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + 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")); + + } + + public void testInvalidConverter1() throws Exception { + + DAS das = DAS.FACTORY.createDAS(getConfig("InvalidConverter.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 + try { + select.executeQuery(); + } catch (Exception ex) { + assertEquals("java.lang.ClassNotFoundException: not.a.valid.class", ex.getMessage()); + } + + } + + public void testInvalidConverter2() throws Exception { + + HelperContext context = HelperProvider.getDefaultContext(); + CustomerFactory.INSTANCE.register(context); + DAS das = DAS.FACTORY.createDAS(getConfig("InvalidConverter.xml"), getConnection()); + + // Build the select command to read a specific customer and related + // orders + Command select = das.createCommand("SELECT * FROM ANORDER"); + + // Get the graph + + DataObject root = select.executeQuery(); + DataObject order = root.getDataObject("AnOrder[1]"); + + Customer customer = (Customer) root.createDataObject("Customer"); + customer.setID(700); + customer.setLastName("Daniel"); + customer.setAddress("an address"); + + customer.getOrders().add(order); + + try { + das.applyChanges(root); + } catch (Exception ex) { + assertEquals("java.lang.ClassNotFoundException: not.a.valid.class", ex.getMessage()); + } + + } + + /** + * This tests the use of a converter that does not produce a new "type". Instead it + * modifies the original value before storing to the database. In this exampe, the + * converter restores the original value on read. + * + * This is illustrated by obfuscating the lastname value before it is stored to the database and + * deobfuscating on read. + * + */ + public void testConverter3() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConfig("CustomerConfigWithConverter2.xml"), getConnection()); + + // Create and initialize command to read customers + Command read = das.getCommand("getFirstCustomer"); + + // Read + DataObject root = read.executeQuery(); + + //Modify + root.setString("CUSTOMER[1]/LASTNAME", "Some new name"); + + das.applyChanges(root); + + // Read + root = read.executeQuery(); + + // Verify that I can read back the deobfuscated value + assertEquals("Some new name", root.getString("CUSTOMER[1]/LASTNAME")); + + //Now read directly without applying the converter to ensure that the value was obfuscated + //in the database. + DAS das2 = DAS.FACTORY.createDAS(getConnection()); + Command directRead = das2.createCommand("select * from CUSTOMER where ID = 1"); + root = directRead.executeQuery(); + + assertEquals("Fbzr arj anzr", root.getString("CUSTOMER[1]/LASTNAME")); + assertEquals(obfuscate("Some new name"), root.getString("CUSTOMER[1]/LASTNAME")); + + } + + // Utilities + + private String obfuscate (String original) throws Exception { + return toRot13(original); + } + + private String deobfuscate (String obfuscated) throws Exception { + return toRot13(obfuscated); + } + + //A simple, reversible, obfuscation algorithm using a ROT13 implementation + private String toRot13(String original) throws Exception { + + int abyte = 0; + byte[] buffer = original.getBytes("ISO-8859-1"); + + for (int i = 0; i < buffer.length; i++) { + abyte = buffer[i]; + int cap = abyte & 32; + abyte &= ~cap; + abyte = ((abyte >= 'A') && (abyte <= 'Z') ? ((abyte - 'A' + 13) % 26 + 'A') : abyte) | cap; + buffer[i] = (byte) abyte; + } + + return new String(buffer, "ISO-8859-1"); + } + +} diff --git a/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java new file mode 100644 index 0000000000..028861ed77 --- /dev/null +++ b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java @@ -0,0 +1,304 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.config.Table; +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(); + Table customerTable = helper.addTable("CUSTOMER", "CUSTOMER"); + helper.addUpdateStatement(customerTable, "update CUSTOMER set LASTNAME = ? where ID = ?", "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")); + + } + +} diff --git a/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java new file mode 100644 index 0000000000..3067d5ace7 --- /dev/null +++ b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java @@ -0,0 +1,405 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.config.Table; +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(); + } + + public void testDeleteAndCreate() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConfig("basicCustomerMappingWithCUD2.xml"), getConnection()); + // Read customer 1 + Command select = das.createCommand("Select * from CUSTOMER"); + DataObject root = select.executeQuery(); + + DataObject customer = (DataObject) root.get("CUSTOMER[1]"); + + int customerId = customer.getInt("ID"); + // Modify customer + customer.delete(); + + DataObject newCustomer = root.createDataObject("CUSTOMER"); + newCustomer.setInt("ID", 9999); + newCustomer.setString("LASTNAME", "Jones"); + + // Build apply changes command + das.applyChanges(root); + + // Verify changes + root = select.executeQuery(); + boolean found = false; + Iterator i = root.getList("CUSTOMER").iterator(); + while (i.hasNext()) { + customer = (DataObject) i.next(); + assertFalse(customerId == customer.getInt("ID")); + if (customer.getInt("ID") == 9999) { + found = true; + } + } + + assertTrue(found); + + } + + /** + * 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(); + Table customerTable = helper.addTable("CUSTOMER", "CUSTOMER"); + helper.addUpdateStatement(customerTable, "update CUSTOMER set LASTNAME = ?, ADDRESS = ? " + + "where ID = ?", "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(); + assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); + + 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(); + assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); + + 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(); + assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); + + 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(); + assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); + + 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")); + + } + + /** + * Builds on previous but: 1. Uses a named command + */ + public void testReadModifyApply4() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConfig("CustomerConfig.xml"), getConnection()); + // Read customer with particular ID + Command select = das.getCommand("getCustomer"); + select.setParameter(1, new Integer(1)); + DataObject root = select.executeQuery(); + assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); + + 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")); + + } + + public void testReadModifyApplyMultipleRows() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConnection()); + // Verify pre-condition + Command select = das.createCommand("Select * from CUSTOMER"); + DataObject root = select.executeQuery(); + assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); + assertFalse(root.get("CUSTOMER[2]/LASTNAME").equals("Silva")); + + + // Read and modify customer 1 + DataObject customer1 = (DataObject) root.get("CUSTOMER[1]"); + customer1.set("LASTNAME", "Pavick"); + + // Read and modify customer 2 + DataObject customer2 = (DataObject) root.get("CUSTOMER[2]"); + customer2.set("LASTNAME", "Silva"); + + // Build apply changes command + das.applyChanges(root); + + // Verify changes + root = select.executeQuery(); + assertEquals("Pavick", root.getString("CUSTOMER[1]/LASTNAME")); + assertEquals("Silva", root.getString("CUSTOMER[2]/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 = getCustomerByLastName(root, "Daniel"); + 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, "Daniel")); + + } + + 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().indexOf("changed in the DataGraph but is not present in the Config") >= 0); + } + + } + + 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().indexOf("changed in the DataGraph but is not present in the Config") >= 0); + } + + } + + 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().indexOf("changed in the DataGraph but is not present in the Config") >= 0); + } + + } + + 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/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java new file mode 100644 index 0000000000..4eb68c1404 --- /dev/null +++ b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java @@ -0,0 +1,115 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 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.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(); + new BookData(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 = 1"); + DataObject root = select.executeQuery(); + + assertEquals(1, root.getList("SERVERSTATUS").size()); + + } + + + /** + * Test expected failure when applyChanges processes DO with no PK columns. We + * should throw a better error than NPE + */ + + //now with JIRA-1464 , we will get exception in select itself , so can not reach upto + //applyChanges + /*public void testReadUpdateWithNoPKColumns() throws Exception { + + DAS das = DAS.FACTORY.createDAS(getConfig("BooksConfig.xml"),getConnection()); + // Read a book instance + Command select = das.createCommand("SELECT NAME, AUTHOR, QUANTITY, OCC 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 the DO has no PK defined"); + } catch (NullPointerException ex) { + fail("We should do better than an NPE"); + } + }*/ + + +} diff --git a/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DynamicResultDescriptorTests.java b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DynamicResultDescriptorTests.java new file mode 100644 index 0000000000..d2535a2223 --- /dev/null +++ b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DynamicResultDescriptorTests.java @@ -0,0 +1,351 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 java.util.List; + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.DAS; +import org.apache.tuscany.das.rdb.config.ConfigFactory; +import org.apache.tuscany.das.rdb.config.ResultDescriptor; +import org.apache.tuscany.das.rdb.test.data.CustomerData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; + +import commonj.sdo.DataObject; + +public class DynamicResultDescriptorTests extends DasTest { + + protected void setUp() throws Exception { + super.setUp(); + new CustomerData(getAutoConnection()).refresh(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + /** + * Set result descriptor on Command dynamically + */ + public void testSetResultDescriptors() throws Exception { + ConfigFactory factory = ConfigFactory.INSTANCE; + DAS das = DAS.FACTORY.createDAS(getConnection()); + // Read a customer + Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1"); + + List resultDescriptorList = new ArrayList(); + //as long as columnIndex is correct, order in ArrayList does not matter + ResultDescriptor desc3 = factory.createResultDescriptor(); + desc3.setColumnIndex(3); + desc3.setColumnName("ADDRESS"); + desc3.setColumnType("commonj.sdo.String"); + desc3.setTableName("CUSTOMER"); + + ResultDescriptor desc1 = factory.createResultDescriptor(); + desc1.setColumnIndex(1); + desc1.setColumnName("ID"); + desc1.setColumnType("commonj.sdo.Int"); + desc1.setTableName("CUSTOMER"); + + ResultDescriptor desc2 = factory.createResultDescriptor(); + desc2.setColumnIndex(2); + desc2.setColumnName("LASTNAME"); + desc2.setColumnType("commonj.sdo.String"); + desc2.setTableName("CUSTOMER"); + + resultDescriptorList.add(desc3); + resultDescriptorList.add(desc1); + resultDescriptorList.add(desc2); + + select.setResultDescriptors(resultDescriptorList); + DataObject root = select.executeQuery(); + assertEquals(1, root.getList("CUSTOMER").size()); + } + + /** + * Set a result descriptor on Command dynamically + * and later replace it with another invalid one, and check failure + */ + public void testReplaceResultDescriptors() throws Exception { + ConfigFactory factory = ConfigFactory.INSTANCE; + DAS das = DAS.FACTORY.createDAS(getConnection()); + // Read a customer + Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1"); + + List resultDescriptorList = new ArrayList(); + //as long as columnIndex is correct, order in ArrayList does not matter + ResultDescriptor desc3 = factory.createResultDescriptor(); + desc3.setColumnIndex(3); + desc3.setColumnName("ADDRESS"); + desc3.setColumnType("commonj.sdo.String"); + desc3.setTableName("CUSTOMER"); + + ResultDescriptor desc1 = factory.createResultDescriptor(); + desc1.setColumnIndex(1); + desc1.setColumnName("ID"); + desc1.setColumnType("commonj.sdo.Int"); + desc1.setTableName("CUSTOMER"); + + ResultDescriptor desc2 = factory.createResultDescriptor(); + desc2.setColumnIndex(2); + desc2.setColumnName("LASTNAME"); + desc2.setColumnType("commonj.sdo.String"); + desc2.setTableName("CUSTOMER"); + + resultDescriptorList.add(desc3); + resultDescriptorList.add(desc1); + resultDescriptorList.add(desc2); + + select.setResultDescriptors(resultDescriptorList); + DataObject root = select.executeQuery(); + assertEquals(1, root.getList("CUSTOMER").size()); + + //Now use invalid one + resultDescriptorList.clear(); + + desc3.setColumnIndex(3); + desc3.setColumnName("ADDRESS"); + desc3.setColumnType("commonj.sdo.Int");//incompatible type + desc3.setTableName("CUSTOMER"); + + desc1.setColumnIndex(1); + desc1.setColumnName("ID"); + desc1.setColumnType("commonj.sdo.Int"); + desc1.setTableName("CUSTOMER"); + + desc2 = factory.createResultDescriptor(); + desc2.setColumnIndex(2); + desc2.setColumnName("LASTNAME"); + desc2.setColumnType("commonj.sdo.String"); + desc2.setTableName("CUSTOMER"); + + resultDescriptorList.add(desc3); + resultDescriptorList.add(desc2); + resultDescriptorList.add(desc1); + + select.setResultDescriptors(resultDescriptorList); + try{ + root = select.executeQuery(); + fail("Expected exception"); + }catch(Exception e){ + assertTrue(e instanceof ClassCastException); + } + } + + /** + * Set result descriptor on Command dynamically + * , overriding the one set from static config. + */ + public void testOverrideResultDescriptorsFromConfig() throws Exception { + ConfigFactory factory = ConfigFactory.INSTANCE; + DAS das = DAS.FACTORY.createDAS(getConfig("customerMappingWithResultDescriptor.xml"), getConnection()); + Command select = das.getCommand("testSelectCustomer"); + DataObject root = select.executeQuery(); + List custList = root.getList("CUSTOMER"); + assertEquals("Williams", ((DataObject)custList.get(0)).getString("LASTNAME")); + + List resultDescriptorList = new ArrayList(); + + ResultDescriptor desc3 = factory.createResultDescriptor(); + desc3.setColumnIndex(3); + desc3.setColumnName("ADDRESS"); + desc3.setColumnType("commonj.sdo.Int");//incompatible type + desc3.setTableName("CUSTOMER"); + + ResultDescriptor desc1 = factory.createResultDescriptor(); + desc1.setColumnIndex(1); + desc1.setColumnName("ID"); + desc1.setColumnType("commonj.sdo.Int"); + desc1.setTableName("CUSTOMER"); + + ResultDescriptor desc2 = factory.createResultDescriptor(); + desc2.setColumnIndex(2); + desc2.setColumnName("LASTNAME"); + desc2.setColumnType("commonj.sdo.String"); + desc2.setTableName("CUSTOMER"); + + resultDescriptorList.add(desc3); + resultDescriptorList.add(desc1); + resultDescriptorList.add(desc2); + + select.setResultDescriptors(resultDescriptorList); + try{ + select.executeQuery(); + fail("Expected exception"); + }catch(Exception e){ + assertTrue(e instanceof ClassCastException); + } + } + + /** + * Set null result descriptor on Command dynamically + */ + public void testNullResultDescriptors() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConnection()); + // Read a customer + Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1"); + + List resultDescriptorList = null; + + try{ + select.setResultDescriptors(resultDescriptorList); + + select.executeQuery(); + this.assertTrue("Derby has DBMS metadata, so it will be used", true); + }catch(RuntimeException e){ + fail("Expected to succeed with no exception"); + } + } + + /** + * Set -ve columnIndex in result descriptor on Command dynamically + * Set will not be sorted and Type mismatch wi (Int and String for ID) + * will throw exception + */ + public void testNegativeIndexResultDescriptors() throws Exception { + ConfigFactory factory = ConfigFactory.INSTANCE; + DAS das = DAS.FACTORY.createDAS(getConnection()); + // Read a customer + Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1"); + + List resultDescriptorList = new ArrayList(); + + ResultDescriptor desc3 = factory.createResultDescriptor(); + desc3.setColumnIndex(-3);//invalid + desc3.setColumnName("ADDRESS"); + desc3.setColumnType("commonj.sdo.String"); + desc3.setTableName("CUSTOMER"); + + ResultDescriptor desc1 = factory.createResultDescriptor(); + desc1.setColumnIndex(1); + desc1.setColumnName("ID"); + desc1.setColumnType("commonj.sdo.Int"); + desc1.setTableName("CUSTOMER"); + + ResultDescriptor desc2 = factory.createResultDescriptor(); + desc2.setColumnIndex(2); + desc2.setColumnName("LASTNAME"); + desc2.setColumnType("commonj.sdo.String"); + desc2.setTableName("CUSTOMER"); + + resultDescriptorList.add(desc3); + resultDescriptorList.add(desc1); + resultDescriptorList.add(desc2); + + try{ + select.setResultDescriptors(resultDescriptorList); + + select.executeQuery(); + fail("Expected exception"); + }catch(RuntimeException e){ + assertTrue("Exception as sorting wil not happen due to -ve columnIndex", true); + } + } + + /** + * Set matching columnIndices in result descriptor on Command dynamically + */ + public void testMatchingIndexResultDescriptor() throws Exception { + ConfigFactory factory = ConfigFactory.INSTANCE; + DAS das = DAS.FACTORY.createDAS(getConnection()); + // Read a customer + Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1"); + + List resultDescriptorList = new ArrayList(); + + ResultDescriptor desc3 = factory.createResultDescriptor(); + desc3.setColumnIndex(1);//two times index is 1 + desc3.setColumnName("ADDRESS"); + desc3.setColumnType("commonj.sdo.String"); + desc3.setTableName("CUSTOMER"); + + ResultDescriptor desc1 = factory.createResultDescriptor(); + desc1.setColumnIndex(1); + desc1.setColumnName("ID"); + desc1.setColumnType("commonj.sdo.Int"); + desc1.setTableName("CUSTOMER"); + + ResultDescriptor desc2 = factory.createResultDescriptor(); + desc2.setColumnIndex(2); + desc2.setColumnName("LASTNAME"); + desc2.setColumnType("commonj.sdo.String"); + desc2.setTableName("CUSTOMER"); + + resultDescriptorList.add(desc3); + resultDescriptorList.add(desc1); + resultDescriptorList.add(desc2); + + try{ + select.setResultDescriptors(resultDescriptorList); + + select.executeQuery(); + fail("Expected exception"); + }catch(RuntimeException e){ + assertTrue(e.getMessage().indexOf("Two columns in Result Descriptor can not have same index")!= -1); + } + } + + public void testAddRemoveResultDescriptor() throws Exception { + ConfigFactory factory = ConfigFactory.INSTANCE; + + ResultDescriptor desc3 = factory.createResultDescriptor(); + desc3.setColumnIndex(3);//two times index is 1 + desc3.setColumnName("ADDRESS"); + desc3.setColumnType("commonj.sdo.String"); + desc3.setTableName("CUSTOMER"); + + ResultDescriptor desc1 = factory.createResultDescriptor(); + desc1.setColumnIndex(1); + desc1.setColumnName("ID"); + desc1.setColumnType("commonj.sdo.Int"); + desc1.setTableName("CUSTOMER"); + + ResultDescriptor desc2 = factory.createResultDescriptor(); + desc2.setColumnIndex(2); + desc2.setColumnName("LASTNAME"); + desc2.setColumnType("commonj.sdo.String"); + desc2.setTableName("CUSTOMER"); + + DAS das = DAS.FACTORY.createDAS(getConnection()); + // Read a customer + Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1"); + select.addResultDescriptor(desc3); + select.addResultDescriptor(desc1); + select.addResultDescriptor(desc2); + //select.printResultDescriptors(System.out); + assertEquals(1, ((ResultDescriptor)select.getResultDescriptors().get(0)).getColumnIndex()); + assertEquals(2, ((ResultDescriptor)select.getResultDescriptors().get(1)).getColumnIndex()); + assertEquals(3, ((ResultDescriptor)select.getResultDescriptors().get(2)).getColumnIndex()); + + select.removeResultDescriptor(2); + //select.printResultDescriptors(System.out); + assertEquals(1, ((ResultDescriptor)select.getResultDescriptors().get(0)).getColumnIndex()); + assertEquals(3, ((ResultDescriptor)select.getResultDescriptors().get(1)).getColumnIndex()); + + select.removeResultDescriptor(desc3); + //select.printResultDescriptors(System.out); + assertEquals(1, ((ResultDescriptor)select.getResultDescriptors().get(0)).getColumnIndex()); + + select.addResultDescriptor(null); + select.removeResultDescriptor(null); + //select.printResultDescriptors(System.out); + assertEquals(1, ((ResultDescriptor)select.getResultDescriptors().get(0)).getColumnIndex()); + } +} diff --git a/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java new file mode 100644 index 0000000000..4da0df87ae --- /dev/null +++ b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java @@ -0,0 +1,153 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 java.sql.SQLException; + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.DAS; +import org.apache.tuscany.das.rdb.test.companynoid.CompanynoidFactory; +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.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.data.OrderDetailsData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; + +import commonj.sdo.helper.HelperContext; +import commonj.sdo.impl.HelperProvider; + +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(); + new CompanyData(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 { + HelperContext context = HelperProvider.getDefaultContext(); + CustomerFactory.INSTANCE.register(context); + 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()); + } + + } + + public void testMismatchedDataObjectModel() throws SQLException { + HelperContext context = HelperProvider.getDefaultContext(); + CompanynoidFactory.INSTANCE.register(context); + DAS das = DAS.FACTORY.createDAS(getConfig("companynoidMappingWithConverters.xml"), getConnection()); + Command read = das.createCommand("select * from company"); + try { + read.executeQuery(); + } catch (RuntimeException ex) { + assertEquals("Type CompanynoidType does not contain a property named ID", ex.getMessage()); + } + } + +} diff --git a/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedCommandTests.java b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedCommandTests.java new file mode 100644 index 0000000000..45c83e6167 --- /dev/null +++ b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedCommandTests.java @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedId.java b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedId.java new file mode 100644 index 0000000000..ca8bd19868 --- /dev/null +++ b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedId.java @@ -0,0 +1,313 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 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.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 = new 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 insert into row with generated ID and generated insert + public void testInsert4() throws Exception { + + DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"), getConnection()); + Command select = das.getCommand("all companies"); + DataObject root = select.executeQuery(); + + DataObject company = root.createDataObject("COMPANY"); + company.setString("NAME", "Phil's Tires"); + // This shouldn't do anything + company.setInt("ID", 999); + + das.applyChanges(root); + + // Verify insert + root = select.executeQuery(); + + assertEquals(4, root.getList("COMPANY").size()); + Iterator i = root.getList("COMPANY").iterator(); + while (i.hasNext()) { + DataObject comp = (DataObject) i.next(); + assertFalse(comp.getInt("ID") == 999); + } + + } + + /** + * Test insert into row with generated ID and no attributes set + */ + public void testInsert5() throws Exception { + + DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"), getConnection()); + Command select = das.getCommand("all companies"); + DataObject root = select.executeQuery(); + + root.createDataObject("COMPANY"); + + das.applyChanges(root); + + // Verify insert + root = select.executeQuery(); + assertEquals(4, root.getList("COMPANY").size()); + + } + + + // 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("DEPNUMBER", "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("DEPNUMBER", "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()); + } + } + +} diff --git a/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GraphMergeTests.java b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GraphMergeTests.java new file mode 100644 index 0000000000..a1a7b57433 --- /dev/null +++ b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GraphMergeTests.java @@ -0,0 +1,625 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 java.util.List; + +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.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.merge.impl.GraphMerger; +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.customer.impl.CustomerFactoryImpl; +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.SingerData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; +import org.apache.tuscany.das.rdb.test.singer.SINGER; +import org.apache.tuscany.das.rdb.test.singer.impl.SingerFactoryImpl; +import org.apache.tuscany.sdo.api.SDOUtil; + +import commonj.sdo.DataObject; +import commonj.sdo.Type; +import commonj.sdo.helper.DataFactory; +import commonj.sdo.helper.HelperContext; +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.XMLHelper; +import commonj.sdo.impl.HelperProvider; + +public class GraphMergeTests extends DasTest { + + protected void setUp() throws Exception { + super.setUp(); + + new CustomerData(getAutoConnection()).refresh(); + new OrderData(getAutoConnection()).refresh(); + new SingerData(getAutoConnection()).refresh(); + + } + + public void testCreateEmptyGraph() throws Exception { + String typeUri = "http:///org.apache.tuscany.das.rdb.test/customer.xsd"; + HelperContext context = HelperProvider.getDefaultContext(); + CustomerFactory.INSTANCE.register(context); + ConfigHelper helper = new ConfigHelper(); + helper.setDataObjectModel(typeUri); + DataObject graph = new GraphMerger().emptyGraph(helper.getConfig()); + assertEquals(0, graph.getList("Customer").size()); + assertEquals(0, graph.getList("AnOrder").size()); + + } + + public void testCreateEmptyGraphAndAddCustomer() throws Exception { + String typeUri = "http:///org.apache.tuscany.das.rdb.test/customer.xsd"; + HelperContext context = HelperProvider.getDefaultContext(); + CustomerFactory.INSTANCE.register(context); + ConfigHelper helper = new ConfigHelper(); + helper.setDataObjectModel(typeUri); + helper.addTable("CUSTOMER", "Customer"); + helper.addPrimaryKey("CUSTOMER.ID"); + + DataObject graph = new GraphMerger().emptyGraph(helper.getConfig()); + Customer c = (Customer) graph.createDataObject("Customer"); + c.setID(4000); + c.setLastName("Smith"); + c.setAddress("400 Fourth Street"); + + DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection()); + das.applyChanges(graph); + + Command cmd = das.createCommand("select * from CUSTOMER order by ID desc"); + graph = cmd.executeQuery(); + assertEquals(6, graph.getList("Customer").size()); + assertEquals("Smith", graph.getDataObject("Customer[1]").getString("lastName")); + assertEquals("400 Fourth Street", graph.getDataObject("Customer[1]").getString("address")); + + } + + 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); + List custList = mergedGraph.getList("CUSTOMER"); + for(int i=0; i ?"); + select2.setParameter(1, "3"); + DataObject graph2 = select2.executeQuery(); + assertEquals(2, graph2.getList("CUSTOMER").size()); + + GraphMerger merger = new GraphMerger(); + merger.addPrimaryKey("CUSTOMER.ID"); + DataObject mergedGraph = merger.merge(graph1, graph2); + List custList = mergedGraph.getList("CUSTOMER"); + for(int i=0; i0){ + assertTrue(true);//expected failure + } + } + } + + //join with both tables PKs present in SELECT, child row is complete null, outer join + public void testOuterJoin() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection()); + Command select = das.getCommand("testOuterJoin"); + DataObject root = select.executeQuery(); + List singers = root.getList("SINGER"); + List songs = root.getList("SONG");//as there is no relationship (explicit/implicit) + assertNotNull(singers); + assertEquals(1, singers.size()); + assertNotNull(songs); + assertEquals(0, songs.size()); + } + + //join with both tables' PKs present in SELECT + public void test11() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection()); + Command select = das.getCommand("test11"); + DataObject root = select.executeQuery(); + List owners = root.getList("OWNER"); + List dogs = root.getList("DOG");//as there is no relationship (explicit/implicit) + assertNotNull(owners); + assertNotNull(dogs); + for(int i=0; i0){ + assertTrue(true);//expected failure + } + } + } + + //join with child table's PK missing in SELECT + public void test33() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection()); + Command select = das.getCommand("test33"); + try{ + select.executeQuery(); + fail("Expected exception"); + }catch(RuntimeException e){ + if(e.getMessage(). + indexOf("in query does not include Primary Key "+ + "column or has null value in it, can not proceed!") >0){ + assertTrue(true);//expected failure + } + } + } + + //join with both tables' PK missing in SELECT + public void test44() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection()); + Command select = das.getCommand("test44"); + try{ + select.executeQuery(); + fail("Expected exception"); + }catch(RuntimeException e){ + if(e.getMessage(). + indexOf("in query does not include Primary Key "+ + "column or has null value in it, can not proceed!") >0){ + assertTrue(true);//expected failure + } + } + } + + //join with both tables' PK present in SELECT (use relationship) + public void test11_rel() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection()); + Command select = das.getCommand("test11"); + DataObject root = select.executeQuery(); + List owners = root.getList("OWNER"); + assertNotNull(owners); + assertEquals(3, owners.size()); + + if(owners != null){ + for(int i=0; i0){ + assertTrue(true);//expected failure + } + } + } + + //join with child table's PK missing in SELECT (use relationship) + public void test33_rel() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection()); + Command select = das.getCommand("test33"); + try{ + select.executeQuery(); + fail("Expected exception"); + }catch(RuntimeException e){ + if(e.getMessage(). + indexOf("in query does not include Primary Key "+ + "column or has null value in it, can not proceed!") >0){ + assertTrue(true);//expected failure + } + } + } + + //join with both tables' PK missing in SELECT (use relationship) + public void test44_rel() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection()); + Command select = das.getCommand("test44"); + try{ + select.executeQuery(); + fail("Expected exception"); + }catch(RuntimeException e){ + if(e.getMessage(). + indexOf("in query does not include Primary Key "+ + "column or has null value in it, can not proceed!") >0){ + assertTrue(true);//expected failure + } + } + } + + public void testCompoundPks() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection()); + Command select = das.getCommand("compound_pks"); + DataObject root = select.executeQuery(); + assertEquals(4, root.getList("ORDERDETAILS").size()); + } + + public void testCompoundPksFail() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection()); + Command select = das.getCommand("compound_pks_fail"); + try{ + select.executeQuery(); + fail("Expected exception"); + }catch(RuntimeException e){ + if(e.getMessage(). + indexOf("in query does not include Primary Key "+ + "column or has null value in it, can not proceed!") >0){ + assertTrue(true);//expected failure + } + } + } + + public void testCompoundPksJoin() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection()); + Command select = das.getCommand("compound_pks_join"); + DataObject root = select.executeQuery(); + List ordDetList = root.getList("ORDERDETAILS"); + assertEquals(4, ordDetList.size()); + for(int i=0; i0){ + assertTrue(true);//expected failure + } + } + } + + //case when no PK defined in Config but column ID is there in table and is not in SELECT clause + //convention over configuration should assume it as PK and fail select + public void testPartFail() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection()); + Command select = das.getCommand("testPartFail"); + try{ + select.executeQuery(); + fail("Expected exception"); + }catch(RuntimeException e){ + if(e.getMessage(). + indexOf("in query does not include Primary Key "+ + "column or has null value in it, can not proceed!") >0){ + assertTrue(true);//expected failure + } + } + } + + public void testMultiSchemaPKMiss() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig14.xml"), getConnection()); + + //Explicit compound key relationship between DASTEST1.ORDERDETAILS and DASTEST3.ORDERDETAILSDESC + //ORDERID <-> ORDERID, PRODUCTID<->PRODUCTID + // Read some order details and related order details descs + Command select = das + .createCommand("SELECT DASTEST1.ORDERDETAILS.ORDERID, DASTEST1.ORDERDETAILS.PRODUCTID," + + "DASTEST3.ORDERDETAILSDESC.ORDERID FROM DASTEST1.ORDERDETAILS LEFT JOIN DASTEST3.ORDERDETAILSDESC " + + " ON DASTEST1.ORDERDETAILS.ORDERID = DASTEST3.ORDERDETAILSDESC.ORDERID " + + " AND DASTEST1.ORDERDETAILS.PRODUCTID = DASTEST3.ORDERDETAILSDESC.PRODUCTID"); + + try{ + select.executeQuery(); + fail("Expected exception"); + }catch(RuntimeException e){ + if(e.getMessage(). + indexOf("in query does not include Primary Key "+ + "column or has null value in it, can not proceed!") >0){ + assertTrue(true);//expected failure + } + } + } + + public void testTypePropsDifferent() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection()); + Command select = das.getCommand("get all books"); + try{ + select.executeQuery(); + fail("Expected exception"); + }catch(RuntimeException e){ + if(e.getMessage(). + indexOf("in query does not include Primary Key "+ + "column or has null value in it, can not proceed!") >0){ + assertTrue(true);//expected failure + } + } + } +} diff --git a/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/MultiSchemaTests.java b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/MultiSchemaTests.java new file mode 100644 index 0000000000..ee16434236 --- /dev/null +++ b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/MultiSchemaTests.java @@ -0,0 +1,715 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 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.MultiSchemaData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; + +import commonj.sdo.DataObject; + +public class MultiSchemaTests extends DasTest{ + protected void setUp() throws Exception { + super.setUp(); + new MultiSchemaData(getAutoConnection()).refresh(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + /**If database is present connect to it and create necessary tables, procedures, data etc. + * + * Below is test database schema required. + * Schema Layout - + * Database: DASTEST + * Schema: DASTEST1 + * Tables: CUSTOMER, EMPLOYEE, CITY, ORDERDETAILS + * Schema: DASTEST2 + * Tables: CUSTOMER, ACCOUNT, CITY + * Schema: DASTEST3 + * Tables: CUSTOMER, CUSTORDER, ORDERDETAILSDESC + */ + + public void testMulitiSchemaCase1() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig1.xml"), getConnection()); + //test case 1 - CRUD when schemaName, tableName, typeName present - DASTEST1.CUSTOMER + //System.out.println("Result:test case 1 - CRUD when schemaName, tableName, typeName present:DASTEST1.CUSTOMER"); + //test select + //System.out.println("Result:test case 1 - SELECT"); + assertEquals(getCustomers(das).size(), 3); + + //test insert - basic + //System.out.println("Result:test case 1 - INSERT(execute())"); + addCustomer(das); + assertEquals(getCustomers(das).size(), 4); + + //test insert - use SDO + //System.out.println("Result:test case 1 - INSERT(applyChanges())"); + addSDOCustomer(das); + assertEquals(getCustomers(das).size(), 5); + + //test delete - basic + //System.out.println("Result:test case 1 - DELETE(execute())"); + deleteCustomer(das); + assertEquals(getCustomers(das).size(), 4); + + //test delete - SDO + //System.out.println("Result:test case 1 - DELETE(applyChanges())"); + deleteSDOCustomer(das); + assertEquals(getCustomers(das).size(), 3); + + //test update + //System.out.println("Result:test case 1 - UPDATE"); + changeFirstCustomerName(das); + assertEquals( ((DataObject)getCustomers(das).get(0)).get("LASTNAME"), "Williams"); + //System.out.println("******************************************"); + } + + public void testMultiSchemaCase2()throws Exception{ + DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig2.xml"), getConnection()); + //test case 1 - CRUD when schemaName, tableName present, typeName not present - DASTEST2.ACCOUNT + //System.out.println("Result:test case 2 - CRUD when schemaName, tableName present, typeName not present:DASTEST2.ACCOUNT"); + //test select + //System.out.println("Result:test case 2 - SELECT"); + assertEquals(getAccounts(das).size(), 4); + + //test insert - basic + //System.out.println("Result:test case 2 - INSERT(execute())"); + addAccount(das); + assertEquals(getAccounts(das).size(), 5); + + //test insert - SDO + //System.out.println("Result:test case 2 - INSERT(applyChanges())"); + addSDOAccount(das); + assertEquals(getAccounts(das).size(), 6); + + //test delete - basic + //System.out.println("Result:test case 2 - DELETE(execute())"); + deleteAccount(das); + assertEquals(getAccounts(das).size(), 5); + + //test delete - SDO + //System.out.println("Result:test case 2 - DELETE(applyChanges())"); + deleteSDOAccount(das); + assertEquals(getAccounts(das).size(), 4); + + //test update + //System.out.println("Result:test case 2 - UPDATE"); + changeFirstAccountBalance(das); + assertEquals( ((DataObject)getAccounts(das).get(0)).get("BALANCE"), new Integer(45000)); + //System.out.println("******************************************"); + } + + public void testMultiSchemaCase3() throws Exception{ + DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig3.xml"), getConnection()); + //test case 3 - CRUD when

is not there in config - DASTEST1.CITY + //System.out.println("Result:test case 3 - CRUD when
is not there in config:DASTEST1.CITY"); + //test select + //System.out.println("Result:test case 3 - SELECT"); + assertEquals(getCities(das).size(), 2); + + //test insert - basic + //System.out.println("Result:test case 3 - INSERT(execute())"); + addCity(das); + assertEquals(getCities(das).size(), 3); + + //test insert - SDO + //System.out.println("Result:test case 3 - INSERT(applyChanges())"); + assertEquals(addSDOCity(das),"Expected failure to insert"); + assertEquals(getCities(das).size(), 3); + + //test delete - basic + //System.out.println("Result:test case 3 - DELETE(execute())"); + deleteCity(das); + assertEquals(getCities(das).size(), 2); + + //test delete - SDO + //System.out.println("Result:test case 3 - DELETE(applyChanges())"); + assertEquals(deleteSDOCity(das), "Expected failure to delete"); + assertEquals(getCities(das).size(), 2); + + //test update + //System.out.println("Result:test case 3 - UPDATE"); + assertEquals(changeFirstCityName(das), "Expected failure to update"); + //System.out.println("******************************************"); + } + + public void testMultiSchemaCase4() throws Exception{ + //System.out.println("Result:test case 4 - with multi schema support ON, have table with no schemaName"); + try{ + //get das handle for invalid config + DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaInvalidDasConfig.xml"), getConnection()); + }catch(Exception e){ + //No schemaName provided for tableName CUSTORDER when schemaNameSupport is ON + assertEquals("No schemaName provided for tableName CUSTORDER when schemaNameSupport is ON", + e.getMessage()); + } + + //System.out.println("******************************************"); + } + + public void testMultiSchemaCase5() throws Exception{ + DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig5.xml"), getConnection()); + + //test case 5 - SELECT when CUSTOMER.ID is present in DASTEST1 and DASTEST2 + //and DASTEST2.CUSTOMER
not in config + //System.out.println("Result:test case 5 - SELECT when CUSTOMER.ID is present in DASTEST1 and DASTEST2 and"+ + // " DASTEST2.CUSTOMER
not in config"); + DataObject root = getCustomersFrom2SchemasWithOneSchemaNotInConfig(das); + assertEquals(root.getList("DASTEST1_CUSTOMER").size(), 3); + assertEquals(root.getList("DASTEST2.CUSTOMER").size(), 3); + //System.out.println("******************************************"); + } + + public void testMultiSchemaCase6()throws Exception{ + DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig6.xml"), getConnection()); + //test case 6 - SELECT when CUSTOMER.ID is present in DASTEST1 and DB2ADMIN - and both
entries are in Config + //System.out.println("Result:test case 6 - SELECT when CUSTOMER.ID is present in DASTEST1 and DB2ADMIN, and both
in config"); + //test select + //System.out.println("Result:test case 6 - SELECT"); + DataObject root = getCustomersFrom2SchemasBothSchemaInConfig(das); + assertEquals(root.getList("DASTEST1_CUSTOMER").size(),3); + assertEquals(root.getList("DASTEST3_CUSTOMER").size(),3); + //System.out.println("******************************************"); + } + + public void testMultiSchemaCase7()throws Exception{ + DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig7.xml"), getConnection()); + //test case 7 - SELECT when CITY.INDX is present in DASTEST1 and DASTEST2 and no enrty for + //any
in config + //System.out.println("Result:test case 7 - SELECT when CITY.INDX is present in DASTEST1 and DASTEST2, and no
in config"); + //test select + //System.out.println("Result:test case 7 - SELECT"); + DataObject root = getCitiesFrom2SchemasNoneInConfig(das); + assertEquals(root.getList("DASTEST1.CITY").size(), 2); + assertEquals(root.getList("DASTEST2.CITY").size(), 2); + //System.out.println("******************************************"); + } + + public void testMultiSchemaCase8()throws Exception{ + DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig8.xml"), getConnection()); + + //test case 8 - SELECT using ResultDescriptor - DASTEST2.ACCOUNT + //System.out.println("Result:test case 8 - SELECT using ResultDescriptor:DASTEST2.ACCOUNT"); + assertEquals(getAccountRSDesc(das).size(), 4); + //System.out.println("******************************************"); + } + + public void testMultiSchemaCase9()throws Exception{ + DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig9.xml"), getConnection()); + //test case 9, 11 - Implied relationship , PK when both tables in same schema DASTEST2.CUSTOMER, DASTEST2.ACCOUNT + //System.out.println("Result:test case 9, 11 - Implied relationship when both tables in same schema DASTEST2.CUSTOMER, DASTEST2.ACCOUNT"); + DataObject root = getSingleSchemaCustomersAccounts(das); + assertEquals(root.getList("DASTEST2.CUSTOMER").size(), 2); + assertEquals(root.getList("DASTEST2.ACCOUNT").size(), 4); + //System.out.println("******************************************"); + } + + private static Date kbday; + private static Date tbday; + private static DateFormat myformat = new SimpleDateFormat("yyyy.MM.dd"); + static { + try { + kbday = myformat.parse("1957.09.27"); + tbday = myformat.parse("1966.12.20"); + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + + public void testMultiSchemaCase12()throws Exception{ + DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig12.xml"), getConnection()); + //test case 12 - use converter with multi-schema ON:DASTEST1.EMPLOYEE + //System.out.println("Result:test case 12 - converter on DASTEST1.EMPLOYEE.LASTNAME"); + Command read = das.getCommand("testArbitraryConverter"); + // Read + DataObject root = read.executeQuery(); + + // Verify + assertEquals(kbday,root.getDate("DASTEST1.EMPLOYEE[1]/LASTNAME")); + + // Modify + root.setDate("DASTEST1.EMPLOYEE[1]/LASTNAME", tbday); + das.applyChanges(root); + + // Read + root = read.executeQuery(); + + // Verify + assertEquals(tbday, root.getDate("DASTEST1.EMPLOYEE[1]/LASTNAME")); + + //System.out.println("******************************************"); + } + + public void testMultiSchemaCase13()throws Exception{ + DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig13.xml"), getConnection()); + + //Explicit relationship between DASTEST1.CUSTOMER and DASTEST2.ACCOUNT + //System.out.println("Result:test case13 - Explicit relationship when both tables in different schema DASTEST1.CUSTOMER, DASTEST2.ACCOUNT"); + // Read some customers and related accounts + Command select = das + .createCommand("SELECT * FROM DASTEST1.CUSTOMER LEFT JOIN DASTEST2.ACCOUNT "+ + " ON DASTEST1.CUSTOMER.ID = DASTEST2.ACCOUNT.CUSTOMER_ID"); + + DataObject root = select.executeQuery(); + + DataObject cust1 = root.getDataObject("DASTEST1_CUSTOMER[1]"); + DataObject cust2 = root.getDataObject("DASTEST1_CUSTOMER[2]"); + + // Save IDs + Integer cust1ID = (Integer) cust1.get("ID"); + Integer cust2ID = (Integer) cust2.get("ID"); + + //System.out.println("cust 1 ID :"+cust1ID); + //System.out.println("cust 2 ID :"+cust2ID); + // save account count + Integer cust1AccountCount = new Integer(cust1.getList("accounts").size()); + Integer cust2AccountCount = new Integer(cust2.getList("accounts").size()); + + // Move an account to cust1 from cust2 + DataObject account = (DataObject) cust2.getList("accounts").get(0); + cust1.getList("accounts").add(account); + + // Flush changes + das.applyChanges(root); + + // verify cust1 relationship updates + select = das + .createCommand("SELECT * FROM DASTEST1.CUSTOMER LEFT JOIN DASTEST2.ACCOUNT ON " + + "DASTEST1.CUSTOMER.ID = DASTEST2.ACCOUNT.CUSTOMER_ID where DASTEST1.CUSTOMER.ID = ?"); + select.setParameter(1, cust1ID); + + root = select.executeQuery(); + assertEquals((cust1AccountCount.intValue() + 1), root.getList("DASTEST1_CUSTOMER[1]/accounts").size()); + + // verify cust2 relationship updates + select.setParameter(1, cust2ID); + root = select.executeQuery(); + assertEquals((cust2AccountCount.intValue() - 1),root.getList("DASTEST1_CUSTOMER[1]/accounts").size()); + //System.out.println("******************************************"); + } + + //steer away from implied relationships - we dont support multi schema there!!! + public void testMultiSchemaCase14()throws Exception{ + DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig14.xml"), getConnection()); + + //Explicit compound key relationship between DASTEST1.ORDERDETAILS and DASTEST3.ORDERDETAILSDESC + //ORDERID <-> ORDERID, PRODUCTID<->PRODUCTID + //System.out.println("Result:test case14 - Explicit compound key relationship when both " + + // "tables in different schema DASTEST1.ORDERDETAILS, DASTEST3.ORDERDETAILSDESC"); + + // Read some order details and related order details descs + Command select = das + .createCommand("SELECT * FROM DASTEST1.ORDERDETAILS LEFT JOIN DASTEST3.ORDERDETAILSDESC " + + " ON DASTEST1.ORDERDETAILS.ORDERID = DASTEST3.ORDERDETAILSDESC.ORDERID " + + " AND DASTEST1.ORDERDETAILS.PRODUCTID = DASTEST3.ORDERDETAILSDESC.PRODUCTID"); + + DataObject root = select.executeQuery(); + + DataObject ordDet1 = root.getDataObject("DASTEST1.ORDERDETAILS[1]"); + DataObject ordDet2 = root.getDataObject("DASTEST1.ORDERDETAILS[2]"); + + // Save IDs + Integer ord1ID = (Integer) ordDet1.get("ORDERID"); + Integer prod1ID = (Integer) ordDet1.get("PRODUCTID"); + + Integer ord2ID = (Integer) ordDet2.get("ORDERID"); + Integer prod2ID = (Integer) ordDet2.get("PRODUCTID"); + + // save order count + Integer order1DetDescCount = new Integer(ordDet1.getList("orderDetailsDesc").size()); + Integer order2DetDescCount = new Integer(ordDet2.getList("orderDetailsDesc").size()); + + // Move an order detail desc to ord det1 from ord det2 + DataObject orderDetailsDesc = (DataObject) ordDet2.getList("orderDetailsDesc").get(0); + ordDet1.getList("orderDetailsDesc").add(orderDetailsDesc); + + // Flush changes + das.applyChanges(root); + + // verify ord det1 relationship updates + select = das + .createCommand("SELECT * FROM DASTEST1.ORDERDETAILS LEFT JOIN DASTEST3.ORDERDETAILSDESC " + + " ON DASTEST1.ORDERDETAILS.ORDERID = DASTEST3.ORDERDETAILSDESC.ORDERID " + + " AND DASTEST1.ORDERDETAILS.PRODUCTID = DASTEST3.ORDERDETAILSDESC.PRODUCTID " + + " where DASTEST1.ORDERDETAILS.ORDERID = ? AND DASTEST1.ORDERDETAILS.PRODUCTID = ?"); + select.setParameter(1, ord1ID); + select.setParameter(2, prod1ID); + + root = select.executeQuery(); + assertEquals((order1DetDescCount.intValue() + 1), + root.getList("DASTEST1.ORDERDETAILS[1]/orderDetailsDesc").size()); + + // verify ord det2 relationship updates + select.setParameter(1, ord2ID); + select.setParameter(2, prod2ID); + + root = select.executeQuery(); + assertEquals((order2DetDescCount.intValue() - 1), + root.getList("DASTEST1.ORDERDETAILS[1]/orderDetailsDesc").size()); + } + + /** + * Display result + * @param list + * @param numCols - number of columns in each row + */ + public static void printList(List list, int numCols){ + if(list != null) + System.out.println("list size:"+list.size()); + + for(int i=0; i to create/update/delete + * through config, with duplicate indexes + * @throws Exception + */ + public void testCUDNamedParameters() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConfig("namedParameter.xml"), getConnection()); + // Read customer 1 + Command select = das.createCommand("Select * from CUSTOMER where ID = 1"); + DataObject root = select.executeQuery(); + assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); + + // Modify customer + DataObject customer = (DataObject) root.get("CUSTOMER[1]"); + customer.set("LASTNAME", "Pavick"); + customer.set("ADDRESS", "Pavick's Address"); + // Build apply changes command + try{ + das.applyChanges(root); + fail("Expected exception"); + }catch(RuntimeException e){ + assertTrue(e.getMessage().startsWith("Parameters with improper indexes!")); + } + + //create + root = select.executeQuery(); + DataObject newCustomer = root.createDataObject("CUSTOMER"); + newCustomer.setInt("ID", 6); + newCustomer.setString("LASTNAME", "Louise"); + newCustomer.setString("ADDRESS", "U.K."); + try{ + das.applyChanges(root); + fail("Expected exception"); + }catch(RuntimeException e){ + assertTrue(e.getMessage().startsWith("Parameters with duplicate indexes!")); + } + + //delete + root = select.executeQuery(); + DataObject toBeDeleted = root.getDataObject("CUSTOMER[1]"); + toBeDeleted.setString("LASTNAME", "Pavick"); + toBeDeleted.delete(); + das.applyChanges(root); + root = select.executeQuery(); + assertEquals(null, root.getDataObject("CUSTOMER[1]")); + + } + + /** + * Test passing List to Command through config + * @throws Exception + */ + public void testCommandNamedParameters() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConfig("namedParameter.xml"), getConnection()); + //select + Command select = das.getCommand("getCustomer"); + select.setParameter("ID", new Integer(1)); + DataObject root = select.executeQuery(); + List customers = root.getList("CUSTOMER"); + assertEquals(1, customers.size()); + DataObject customer = (DataObject)customers.get(0); + assertEquals("Williams", customer.get("LASTNAME")); + + //insert - command in config has + Command insert = das.getCommand("createCustomer"); + //see order is not maintained, but config depicts it through index attrb + //if index is missing , auto increment logic will be followed + insert.setParameter("LASTNAME", "Louise"); + insert.setParameter("ADDRESS", "TPO"); + insert.setParameter("ID", new Integer(6)); + insert.execute(); + select.setParameter("ID", new Integer(6)); + root = select.executeQuery(); + customers = root.getList("CUSTOMER"); + assertEquals(1, customers.size()); + customer = (DataObject)customers.get(0); + assertEquals("Louise", customer.get("LASTNAME")); + + //insert - command in config has no + Command insertNoParam = das.getCommand("createCustomerNoParam"); + //if param/index is missing in cfg, auto increment logic will be followed + insertNoParam.setParameter("ID", new Integer(7)); + insertNoParam.setParameter("LASTNAME", "Louise7"); + insertNoParam.setParameter("ADDRESS", "TPO7"); + insertNoParam.execute(); + select.setParameter("ID", new Integer(7)); + root = select.executeQuery(); + customers = root.getList("CUSTOMER"); + assertEquals(1, customers.size()); + customer = (DataObject)customers.get(0); + assertEquals("Louise7", customer.get("LASTNAME")); + + //update + Command update = das.getCommand("updateCustomer"); + update.setParameter("LASTNAME", "NoLouise"); + update.setParameter("ID", new Integer(6)); + update.execute(); + select.setParameter("ID", new Integer(6)); + root = select.executeQuery(); + customers = root.getList("CUSTOMER"); + assertEquals(1, customers.size()); + customer = (DataObject)customers.get(0); + assertEquals("NoLouise", customer.get("LASTNAME")); + + //update - no param in config + Command updateNoParam = das.getCommand("updateCustomerNoParam"); + updateNoParam.setParameter("LASTNAME", "YesLouise"); + updateNoParam.setParameter("ID", new Integer(6)); + updateNoParam.execute(); + select.setParameter("ID", new Integer(6)); + root = select.executeQuery(); + customers = root.getList("CUSTOMER"); + assertEquals(1, customers.size()); + customer = (DataObject)customers.get(0); + assertEquals("YesLouise", customer.get("LASTNAME")); + + //delete + Command delete = das.getCommand("deleteCustomer"); + delete.setParameter("ID", new Integer(6)); + delete.execute(); + select.setParameter("ID", new Integer(6)); + root = select.executeQuery(); + customers = root.getList("CUSTOMER"); + assertEquals(0, customers.size()); + + //delete - cfg command with no param + Command deleteNoParam = das.getCommand("deleteCustomerNoParam"); + deleteNoParam.setParameter("ID", new Integer(7)); + deleteNoParam.execute(); + select.setParameter("ID", new Integer(7)); + root = select.executeQuery(); + customers = root.getList("CUSTOMER"); + assertEquals(0, customers.size()); + } + + /** + * Test passing List to Command through program + * @throws Exception + */ + public void testProgrammaticCommandNamedParameters() throws Exception { + ConfigHelper helper = new ConfigHelper(); + //Command insertAdhoc = das.createCommand("insert into CUSTOMER values (?, ?, ?)"); + org.apache.tuscany.das.rdb.config.Command insertAdhoc = ConfigFactory.INSTANCE.createCommand(); + insertAdhoc.setKind("insert"); + insertAdhoc.setSQL("insert into CUSTOMER values (?, ?, ?)"); + insertAdhoc.setName("insertCustomer"); + Parameter parameter1 = ConfigFactory.INSTANCE.createParameter(); + parameter1.setName("ID"); + Parameter parameter2 = ConfigFactory.INSTANCE.createParameter(); + parameter2.setName("LASTNAME"); + Parameter parameter3 = ConfigFactory.INSTANCE.createParameter(); + parameter3.setName("ADDRESS"); + insertAdhoc.getParameter().add(parameter1); + insertAdhoc.getParameter().add(parameter2); + insertAdhoc.getParameter().add(parameter3); + Config cfg = helper.getConfig(); + cfg.getCommand().add(insertAdhoc); + DAS das = DAS.FACTORY.createDAS(cfg, getConnection()); + + //setup is over, now set values in params and execute + Command insert = das.getCommand("insertCustomer"); + insert.setParameter("ID", new Integer(6)); + insert.setParameter("LASTNAME", "Anthony"); + insert.setParameter("ADDRESS", "IND"); + insert.execute(); + + Command select = das.createCommand("select * from CUSTOMER where ID = ?"); + select.setParameter("ID", new Integer(6)); + DataObject root = select.executeQuery(); + List customers = root.getList("CUSTOMER"); + assertEquals(1, customers.size()); + DataObject customer = (DataObject)customers.get(0); + assertEquals("Anthony", customer.get("LASTNAME")); + } + + /** + * Test set/getParameter(name) on Command + * @throws Exception + */ + public void testNamedParameters() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConnection()); + Command insertAdhoc = das.createCommand("insert into CUSTOMER values (?, ?, ?)"); + insertAdhoc.setParameter("ID", new Integer(6)); + insertAdhoc.setParameter("LASTNAME", "MyLastName"); + insertAdhoc.setParameter("ADDRESS", "MyLastAddress"); + assertEquals("MyLastAddress", insertAdhoc.getParameter("ADDRESS")); + insertAdhoc.execute(); + + Command select = das.createCommand("select * from CUSTOMER where ID = ?"); + select.setParameter("ID", new Integer(6)); + DataObject root = select.executeQuery(); + List customers = root.getList("CUSTOMER"); + assertEquals(1, customers.size()); + DataObject customer = (DataObject)customers.get(0); + assertEquals("MyLastName", customer.get("LASTNAME")); + + } +} diff --git a/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OCCTests.java b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OCCTests.java new file mode 100644 index 0000000000..00a417da8d --- /dev/null +++ b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OCCTests.java @@ -0,0 +1,163 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.ConfigHelper; +import org.apache.tuscany.das.rdb.DAS; +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.ConfigFactory; +import org.apache.tuscany.das.rdb.exception.OptimisticConcurrencyException; +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.framework.DasTest; + +import commonj.sdo.DataObject; + +public class OCCTests extends DasTest { + protected void setUp() throws Exception { + super.setUp(); + + new BookData(getAutoConnection()).refresh(); + new CustomerData(getAutoConnection()).refresh(); + } + + public void testAutomaticOCC() throws SQLException { + 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(); + + // Explicitly update the DB to force a collision + Command update = das.createCommand("update CUSTOMER set LASTNAME = 'Smith' where ID = 1"); + update.execute(); + + DataObject customer = root.getDataObject("CUSTOMER[1]"); + + // Modify customer + customer.set("LASTNAME", "Pavick"); + + // Build apply changes command + try { + das.applyChanges(root); + fail("An OCCException should be thrown"); + } catch (OptimisticConcurrencyException ex) { + if (!ex.getMessage().equals("An update collision occurred")) { + throw ex; + } + } + + } + + public void testSimpleOCC() throws SQLException { + + 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 An update collision occurred + try { + das.applyChanges(root); + fail("An OCCException should be thrown"); + } catch (OptimisticConcurrencyException ex) { + if (!ex.getMessage().equals("An update collision occurred")) { + throw ex; + } + } + } + + public void testManagedOCC() throws SQLException { + 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 SQLException { + 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 An update collision occurred + try { + das.applyChanges(root); + fail("An OCCException should be thrown"); + } catch (OptimisticConcurrencyException ex) { + if (!ex.getMessage().equals("An update collision occurred")) { + throw ex; + } + } + } + + public void testProvidedConfig() throws SQLException { + // Create config programmatically + Config config = ConfigFactory.INSTANCE.createConfig(); + ConfigHelper helper = new ConfigHelper(config); + 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")); + } +} diff --git a/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OneToOneRelationshipTests.java b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OneToOneRelationshipTests.java new file mode 100644 index 0000000000..2a58ca0fba --- /dev/null +++ b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OneToOneRelationshipTests.java @@ -0,0 +1,174 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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(); + + employee = root.getDataObject("COMPANY[1]/company->employee_opposite"); + + assertEquals("Joe Hotshot", employee.getString("NAME")); + + } + + public void testRestrictedOneToOneRelationship() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConfig("OneToOneRestrictedConfig.xml"), getConnection()); + + Command read = das.getCommand("get named employee with company"); + read.setParameter(1, "Mary Smith"); + DataObject root = read.executeQuery(); + DataObject mary = root.getDataObject("EMPLOYEE[1]"); + DataObject company = mary.getDataObject("company"); + + DataObject bob = root.createDataObject("EMPLOYEE"); + bob.setString("NAME", "bob"); + bob.setString("SN", "E0005"); + bob.setInt("MANAGER", 0); + + bob.setDataObject("company", company); + + try { + das.applyChanges(root); + fail("Relationship modification should not be allowed."); + } catch (RuntimeException ex) { + assertEquals("Can not modify a one to one relationship that is key restricted", ex.getMessage()); + } + assertEquals("ACME Publishing", company.getString("NAME")); + + } +} diff --git a/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OperationOrderingTests.java b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OperationOrderingTests.java new file mode 100644 index 0000000000..53cd02778b --- /dev/null +++ b/das-java/trunk/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OperationOrderingTests.java @@ -0,0 +1,124 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 java.util.Iterator; +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.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 { + + public OperationOrderingTests() { + super(); + } + + 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 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()); + } + + public void testDeletes() 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(); + + DataObject firstState = root.getDataObject("STATES[1]"); + String stateName = firstState.getString("NAME"); + + List cityNames = new ArrayList(); + DataObject[] citiesToDelete = new DataObject[firstState.getList("cities").size()]; + Iterator i = firstState.getList("cities").iterator(); + int ii=0; + //if we perform delete() in while, the 2nd city of the state is not deleted. + while (i.hasNext()) { + DataObject firstCity = (DataObject) i.next(); + cityNames.add(firstCity.getString("NAME")); + citiesToDelete[ii] = firstCity; + ii++; + } + + for(int j=0; j
+ +
+ + + + +
+ + + + + + + diff --git a/das-java/trunk/rdb/src/test/resources/BooksConfig.xml b/das-java/trunk/rdb/src/test/resources/BooksConfig.xml new file mode 100644 index 0000000000..2da86cbdb2 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/BooksConfig.xml @@ -0,0 +1,30 @@ + + + + + + + + + + +
+ +
diff --git a/das-java/trunk/rdb/src/test/resources/BooksConfigWithAlias.xml b/das-java/trunk/rdb/src/test/resources/BooksConfigWithAlias.xml new file mode 100644 index 0000000000..91bdccfac5 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/BooksConfigWithAlias.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + +
+ +
diff --git a/das-java/trunk/rdb/src/test/resources/CompanyConfig.xml b/das-java/trunk/rdb/src/test/resources/CompanyConfig.xml new file mode 100644 index 0000000000..793697c314 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/CompanyConfig.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + +
+ + + +
+ + + + + + +
diff --git a/das-java/trunk/rdb/src/test/resources/CompanyEmployeeConfig.xml b/das-java/trunk/rdb/src/test/resources/CompanyEmployeeConfig.xml new file mode 100644 index 0000000000..0e25268afa --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/CompanyEmployeeConfig.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + + + +
+ diff --git a/das-java/trunk/rdb/src/test/resources/CustomerConfig.xml b/das-java/trunk/rdb/src/test/resources/CustomerConfig.xml new file mode 100644 index 0000000000..ed544f39dd --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/CustomerConfig.xml @@ -0,0 +1,24 @@ + + + + + + + diff --git a/das-java/trunk/rdb/src/test/resources/CustomerConfigWithConverter.xml b/das-java/trunk/rdb/src/test/resources/CustomerConfigWithConverter.xml new file mode 100644 index 0000000000..b38922b53a --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/CustomerConfigWithConverter.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + +
+ +
diff --git a/das-java/trunk/rdb/src/test/resources/CustomerConfigWithConverter2.xml b/das-java/trunk/rdb/src/test/resources/CustomerConfigWithConverter2.xml new file mode 100644 index 0000000000..bb49a414c4 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/CustomerConfigWithConverter2.xml @@ -0,0 +1,29 @@ + + + + + + + + + +
+ +
diff --git a/das-java/trunk/rdb/src/test/resources/CustomerConfigWithIDConverter.xml b/das-java/trunk/rdb/src/test/resources/CustomerConfigWithIDConverter.xml new file mode 100644 index 0000000000..9a567b7ea8 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/CustomerConfigWithIDConverter.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + +
+ +
diff --git a/das-java/trunk/rdb/src/test/resources/CustomersOrdersConfig.xml b/das-java/trunk/rdb/src/test/resources/CustomersOrdersConfig.xml new file mode 100644 index 0000000000..323c8cb6ba --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/CustomersOrdersConfig.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
diff --git a/das-java/trunk/rdb/src/test/resources/CustomersOrdersConfigProps.xml b/das-java/trunk/rdb/src/test/resources/CustomersOrdersConfigProps.xml new file mode 100644 index 0000000000..992cf3fa3e --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/CustomersOrdersConfigProps.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
diff --git a/das-java/trunk/rdb/src/test/resources/CustomersOrdersRelationship.xml b/das-java/trunk/rdb/src/test/resources/CustomersOrdersRelationship.xml new file mode 100644 index 0000000000..d91460052d --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/CustomersOrdersRelationship.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
diff --git a/das-java/trunk/rdb/src/test/resources/InvalidConfig1.xml b/das-java/trunk/rdb/src/test/resources/InvalidConfig1.xml new file mode 100644 index 0000000000..fa1e353281 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/InvalidConfig1.xml @@ -0,0 +1,32 @@ + + + + + + + +
+ + + + + +
\ No newline at end of file diff --git a/das-java/trunk/rdb/src/test/resources/InvalidConverter.xml b/das-java/trunk/rdb/src/test/resources/InvalidConverter.xml new file mode 100644 index 0000000000..e6c15ad11f --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/InvalidConverter.xml @@ -0,0 +1,36 @@ + + + + + + +
+ + + + +
+ + + + + +
+ diff --git a/das-java/trunk/rdb/src/test/resources/ManagedBooksConfig.xml b/das-java/trunk/rdb/src/test/resources/ManagedBooksConfig.xml new file mode 100644 index 0000000000..c2b833d2bf --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/ManagedBooksConfig.xml @@ -0,0 +1,30 @@ + + + + + + + + + + +
+ +
diff --git a/das-java/trunk/rdb/src/test/resources/MissingPK.xml b/das-java/trunk/rdb/src/test/resources/MissingPK.xml new file mode 100644 index 0000000000..a236f4b0e9 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/MissingPK.xml @@ -0,0 +1,59 @@ + + + + + + + + +
+ + + +
+ + + + + + + + +
+ + + +
+ + + + + +
+ + + + + + + +
+ +
diff --git a/das-java/trunk/rdb/src/test/resources/MissingPKREL.xml b/das-java/trunk/rdb/src/test/resources/MissingPKREL.xml new file mode 100644 index 0000000000..0efd7bf63c --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/MissingPKREL.xml @@ -0,0 +1,63 @@ + + + + + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + +
+ + + +
+ + + + + + +
diff --git a/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig1.xml b/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig1.xml new file mode 100644 index 0000000000..2555a9ed64 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig1.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + +
+ +
diff --git a/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig12.xml b/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig12.xml new file mode 100644 index 0000000000..63ac8230ce --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig12.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + +
+ +
diff --git a/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig13.xml b/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig13.xml new file mode 100644 index 0000000000..6458108a63 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig13.xml @@ -0,0 +1,34 @@ + + + + + + +
+ + + +
+ + + + + +
diff --git a/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig14.xml b/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig14.xml new file mode 100644 index 0000000000..4b37a11138 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig14.xml @@ -0,0 +1,37 @@ + + + + + + + +
+ + + +
+ + + + + + + +
diff --git a/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig2.xml b/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig2.xml new file mode 100644 index 0000000000..d055735590 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig2.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + +
+ + + +
+ + + + + +
diff --git a/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig3.xml b/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig3.xml new file mode 100644 index 0000000000..06727c6a79 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig3.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + diff --git a/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig5.xml b/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig5.xml new file mode 100644 index 0000000000..6915c69576 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig5.xml @@ -0,0 +1,32 @@ + + + + + + + + + + +
+ +
diff --git a/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig6.xml b/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig6.xml new file mode 100644 index 0000000000..fd3d177ad4 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig6.xml @@ -0,0 +1,38 @@ + + + + + + + + + + +
+ + + + +
+ + +
diff --git a/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig7.xml b/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig7.xml new file mode 100644 index 0000000000..eab57c759e --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig7.xml @@ -0,0 +1,26 @@ + + + + + + + diff --git a/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig8.xml b/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig8.xml new file mode 100644 index 0000000000..205010c5c6 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig8.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + +
+ +
diff --git a/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig9.xml b/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig9.xml new file mode 100644 index 0000000000..84a10531aa --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/MultiSchemaDasConfig9.xml @@ -0,0 +1,30 @@ + + + + + + + + +
+ +
diff --git a/das-java/trunk/rdb/src/test/resources/MultiSchemaInvalidDasConfig.xml b/das-java/trunk/rdb/src/test/resources/MultiSchemaInvalidDasConfig.xml new file mode 100644 index 0000000000..4658493dbd --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/MultiSchemaInvalidDasConfig.xml @@ -0,0 +1,47 @@ + + + + + + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
diff --git a/das-java/trunk/rdb/src/test/resources/OneToOneNonRestrictedConfig.xml b/das-java/trunk/rdb/src/test/resources/OneToOneNonRestrictedConfig.xml new file mode 100644 index 0000000000..a1266f43de --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/OneToOneNonRestrictedConfig.xml @@ -0,0 +1,51 @@ + + + + + + + +
+ + + +
+ + + + + + + + + +
+ + + +
+ + + + + +
\ No newline at end of file diff --git a/das-java/trunk/rdb/src/test/resources/OneToOneRestrictedConfig.xml b/das-java/trunk/rdb/src/test/resources/OneToOneRestrictedConfig.xml new file mode 100644 index 0000000000..c9ef484513 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/OneToOneRestrictedConfig.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + + + + + + + +
+ + + +
+ + + + + +
+ diff --git a/das-java/trunk/rdb/src/test/resources/OrderDetailsAndDescription.xml b/das-java/trunk/rdb/src/test/resources/OrderDetailsAndDescription.xml new file mode 100644 index 0000000000..d5bc8d44a8 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/OrderDetailsAndDescription.xml @@ -0,0 +1,35 @@ + + + + + + + +
+ + + +
+ + + + + +
diff --git a/das-java/trunk/rdb/src/test/resources/OrdersOrderDetailsConfig.xml b/das-java/trunk/rdb/src/test/resources/OrdersOrderDetailsConfig.xml new file mode 100644 index 0000000000..2e998ee57e --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/OrdersOrderDetailsConfig.xml @@ -0,0 +1,36 @@ + + + + + + + +
+ + + +
+ + + + + +
diff --git a/das-java/trunk/rdb/src/test/resources/PartsConfig.xml b/das-java/trunk/rdb/src/test/resources/PartsConfig.xml new file mode 100644 index 0000000000..b1809079d6 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/PartsConfig.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
diff --git a/das-java/trunk/rdb/src/test/resources/SINGER.xsd b/das-java/trunk/rdb/src/test/resources/SINGER.xsd new file mode 100644 index 0000000000..c843929efb --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/SINGER.xsd @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/das-java/trunk/rdb/src/test/resources/asciifile.txt b/das-java/trunk/rdb/src/test/resources/asciifile.txt new file mode 100644 index 0000000000..d3c922ab52 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/asciifile.txt @@ -0,0 +1 @@ +this is a long file \ No newline at end of file diff --git a/das-java/trunk/rdb/src/test/resources/basicCompanyDepartmentMapping.xml b/das-java/trunk/rdb/src/test/resources/basicCompanyDepartmentMapping.xml new file mode 100644 index 0000000000..bd648cd2ef --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/basicCompanyDepartmentMapping.xml @@ -0,0 +1,39 @@ + + + + + + + +
+ + + + + + + +
+ + + + + +
diff --git a/das-java/trunk/rdb/src/test/resources/basicCompanyMapping.xml b/das-java/trunk/rdb/src/test/resources/basicCompanyMapping.xml new file mode 100644 index 0000000000..b6ca4f9feb --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/basicCompanyMapping.xml @@ -0,0 +1,25 @@ + + + + + + +
+
diff --git a/das-java/trunk/rdb/src/test/resources/basicCustomerMapping.xml b/das-java/trunk/rdb/src/test/resources/basicCustomerMapping.xml new file mode 100644 index 0000000000..a81ca90f8e --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/basicCustomerMapping.xml @@ -0,0 +1,29 @@ + + + + + + + + + +
+ +
diff --git a/das-java/trunk/rdb/src/test/resources/basicCustomerMappingWithCUD.xml b/das-java/trunk/rdb/src/test/resources/basicCustomerMappingWithCUD.xml new file mode 100644 index 0000000000..f27a50f4f3 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/basicCustomerMappingWithCUD.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
diff --git a/das-java/trunk/rdb/src/test/resources/basicCustomerMappingWithCUD2.xml b/das-java/trunk/rdb/src/test/resources/basicCustomerMappingWithCUD2.xml new file mode 100644 index 0000000000..faddf3835b --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/basicCustomerMappingWithCUD2.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
diff --git a/das-java/trunk/rdb/src/test/resources/basicCustomerMappingWithInvalidCUD.xml b/das-java/trunk/rdb/src/test/resources/basicCustomerMappingWithInvalidCUD.xml new file mode 100644 index 0000000000..347cd53f45 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/basicCustomerMappingWithInvalidCUD.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
diff --git a/das-java/trunk/rdb/src/test/resources/basicCustomerOrderMapping.xml b/das-java/trunk/rdb/src/test/resources/basicCustomerOrderMapping.xml new file mode 100644 index 0000000000..c03d9392ed --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/basicCustomerOrderMapping.xml @@ -0,0 +1,35 @@ + + + + + + +
+ + + +
+ + + + + +
+ diff --git a/das-java/trunk/rdb/src/test/resources/basicStaticCustomer.xml b/das-java/trunk/rdb/src/test/resources/basicStaticCustomer.xml new file mode 100644 index 0000000000..c4b4fe56af --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/basicStaticCustomer.xml @@ -0,0 +1,28 @@ + + + + + + + + +
+ +
diff --git a/das-java/trunk/rdb/src/test/resources/cityStates.xml b/das-java/trunk/rdb/src/test/resources/cityStates.xml new file mode 100644 index 0000000000..1908ba4268 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/cityStates.xml @@ -0,0 +1,40 @@ + + + + + + + +
+ + + + + + + +
+ + + + + + +
diff --git a/das-java/trunk/rdb/src/test/resources/company.xsd b/das-java/trunk/rdb/src/test/resources/company.xsd new file mode 100644 index 0000000000..0bf0229201 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/company.xsd @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/das-java/trunk/rdb/src/test/resources/companyMapping.xml b/das-java/trunk/rdb/src/test/resources/companyMapping.xml new file mode 100644 index 0000000000..9388cf8264 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/companyMapping.xml @@ -0,0 +1,42 @@ + + + + + + +
+ + + +
+ + + +
+ + + + + + + + + +
diff --git a/das-java/trunk/rdb/src/test/resources/companyMappingWithConverters.xml b/das-java/trunk/rdb/src/test/resources/companyMappingWithConverters.xml new file mode 100644 index 0000000000..d8609eab96 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/companyMappingWithConverters.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + +
diff --git a/das-java/trunk/rdb/src/test/resources/companyMappingWithResultDescriptor.xml b/das-java/trunk/rdb/src/test/resources/companyMappingWithResultDescriptor.xml new file mode 100644 index 0000000000..419f27eca3 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/companyMappingWithResultDescriptor.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + + + + + + + +
diff --git a/das-java/trunk/rdb/src/test/resources/companynoid.xsd b/das-java/trunk/rdb/src/test/resources/companynoid.xsd new file mode 100644 index 0000000000..7c301ff16a --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/companynoid.xsd @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/das-java/trunk/rdb/src/test/resources/companynoidMappingWithConverters.xml b/das-java/trunk/rdb/src/test/resources/companynoidMappingWithConverters.xml new file mode 100644 index 0000000000..bfbefddd2f --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/companynoidMappingWithConverters.xml @@ -0,0 +1,44 @@ + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + +
diff --git a/das-java/trunk/rdb/src/test/resources/connectionInfoDriverManagerAuth.xml b/das-java/trunk/rdb/src/test/resources/connectionInfoDriverManagerAuth.xml new file mode 100644 index 0000000000..8a6a1880af --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/connectionInfoDriverManagerAuth.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + diff --git a/das-java/trunk/rdb/src/test/resources/connectionInfoDriverManagerNoAuth.xml b/das-java/trunk/rdb/src/test/resources/connectionInfoDriverManagerNoAuth.xml new file mode 100644 index 0000000000..1c7a79acc7 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/connectionInfoDriverManagerNoAuth.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + diff --git a/das-java/trunk/rdb/src/test/resources/customer.xsd b/das-java/trunk/rdb/src/test/resources/customer.xsd new file mode 100644 index 0000000000..e5482ae3a0 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/customer.xsd @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/das-java/trunk/rdb/src/test/resources/customerMapping.xml b/das-java/trunk/rdb/src/test/resources/customerMapping.xml new file mode 100644 index 0000000000..3de367e0c6 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/customerMapping.xml @@ -0,0 +1,28 @@ + + + + + + + + +
+ +
diff --git a/das-java/trunk/rdb/src/test/resources/customerMappingWithResultDescriptor.xml b/das-java/trunk/rdb/src/test/resources/customerMappingWithResultDescriptor.xml new file mode 100644 index 0000000000..587c437423 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/customerMappingWithResultDescriptor.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + +
+ +
diff --git a/das-java/trunk/rdb/src/test/resources/customerOrderRelationshipMapping.xml b/das-java/trunk/rdb/src/test/resources/customerOrderRelationshipMapping.xml new file mode 100644 index 0000000000..fe8d1c5ece --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/customerOrderRelationshipMapping.xml @@ -0,0 +1,34 @@ + + + + + + +
+ + +
+ + + + + +
+ diff --git a/das-java/trunk/rdb/src/test/resources/moin-www.png b/das-java/trunk/rdb/src/test/resources/moin-www.png new file mode 100644 index 0000000000..253471485a Binary files /dev/null and b/das-java/trunk/rdb/src/test/resources/moin-www.png differ diff --git a/das-java/trunk/rdb/src/test/resources/namedParameter.xml b/das-java/trunk/rdb/src/test/resources/namedParameter.xml new file mode 100644 index 0000000000..d0b0811e33 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/namedParameter.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/das-java/trunk/rdb/src/test/resources/passiveConnection.xml b/das-java/trunk/rdb/src/test/resources/passiveConnection.xml new file mode 100644 index 0000000000..6a23200d49 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/passiveConnection.xml @@ -0,0 +1,26 @@ + + + + + + + + + diff --git a/das-java/trunk/rdb/src/test/resources/staticCustomer.xml b/das-java/trunk/rdb/src/test/resources/staticCustomer.xml new file mode 100644 index 0000000000..705e4b34a9 --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/staticCustomer.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/das-java/trunk/rdb/src/test/resources/staticCustomerOrder.xml b/das-java/trunk/rdb/src/test/resources/staticCustomerOrder.xml new file mode 100644 index 0000000000..afbe2a8cfb --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/staticCustomerOrder.xml @@ -0,0 +1,36 @@ + + + + + + + + +
+ + + +
+ + + + + +
diff --git a/das-java/trunk/rdb/src/test/resources/staticInvalid.xml b/das-java/trunk/rdb/src/test/resources/staticInvalid.xml new file mode 100644 index 0000000000..965c99717f --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/staticInvalid.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/das-java/trunk/rdb/src/test/resources/storedProcTest.xml b/das-java/trunk/rdb/src/test/resources/storedProcTest.xml new file mode 100644 index 0000000000..beb1ca34ac --- /dev/null +++ b/das-java/trunk/rdb/src/test/resources/storedProcTest.xml @@ -0,0 +1,27 @@ + + + + + + + + + + diff --git a/das-java/trunk/samples/Readme.htm b/das-java/trunk/samples/Readme.htm new file mode 100644 index 0000000000..ff4fed6d89 --- /dev/null +++ b/das-java/trunk/samples/Readme.htm @@ -0,0 +1,110 @@ + + + + + + +DAS Samples + + + + + +

+
DAS Samples
+

+ +
+ +

The DAS Java Samples demonstrates the DAS features and how to get +started with them. Below a list of available samples:

+ +
+ +

    + + + + + + + + + + + + + + + + + +
    + Company-webapp + + This stand-alone sample demonstrates DAS in the context of a simple web application. +
    + Customer + + This stand-alone sample demonstrates DAS in the context of a simple java application +
    + Advanced-webapp + + This web sample demonstrates DAS advanced features in the context of a simple web application using Ajax. Some of the features demonstrated are : Basic CRUD, Optimistic Concurrency Control (OCC), Result Set Shape, Column Converter, Integration with dbConfig +
    + Transaction + + This stand-alone sample uses DAS with Geronimo Transaction Manager. Connection is passed to DAS by client. Geronimo TM manages database changes involving multiple DataGraphs under one transaction. +
    + +
+ + +

+ diff --git a/das-java/trunk/samples/advanced-webapp/build.xml b/das-java/trunk/samples/advanced-webapp/build.xml new file mode 100644 index 0000000000..e8d9d5fbdf --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/build.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/das-java/trunk/samples/advanced-webapp/pom.xml b/das-java/trunk/samples/advanced-webapp/pom.xml new file mode 100644 index 0000000000..84c6bcac75 --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/pom.xml @@ -0,0 +1,108 @@ + + + + + + org.apache.tuscany.das.samples + tuscany-das-samples + 1.0-SNAPSHOT + + + 4.0.0 + tuscany-das-sample-advanced-webapp + war + Tuscany DAS Advanced Sample + Advanced DAS web applicaiton Sample based on Ajax + + + + + org.apache.tuscany.das + tuscany-das-rdb + ${das.version} + compile + + + + org.apache.tuscany.sdo + tuscany-sdo-impl + ${sdo.version} + compile + + + + org.apache.tuscany.sdo + tuscany-sdo-api-r2.1 + ${sdo.version} + compile + + + + org.apache.tuscany.das.samples + tuscany-das-sample-dbconfig + ${das.version} + compile + + + org.apache.derby + derby + + + + + + javax.servlet + jstl + 1.1.2 + runtime + + + + taglibs + standard + 1.1.1 + + + + tomcat + servlet-api + 5.0.18 + provided + + + + tomcat + jsp-api + 5.0.18 + provided + + + + + + sample-advanced-webapp + src/main/java + + + src/main/java + + + src/main/resources + + + + diff --git a/das-java/trunk/samples/advanced-webapp/readme.htm b/das-java/trunk/samples/advanced-webapp/readme.htm new file mode 100644 index 0000000000..1ddba99e5e --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/readme.htm @@ -0,0 +1,204 @@ + + + + + +Tuscany DAS Sample - Advanced webapp + + + + + + +

Advanced DAS web application Sample

+ +
+ +

+This web sample demonstrates DAS advanced features in the context of a simple web application using Ajax.
+The application user can navigate the menu to see examples of different DAS features.
+The application uses "dbConfig" utility to create canned Derby database with required tables and populate initial data in them. For refreshing database data to initial state, user can click on Refresh Button.
+

+ +
    +
  • Adhoc Query (CRUD operations on COMPANY and DEPARTMENT using adhoc Sql statements)
  • +
  • DAS Command (CRUD operations on COMPANY and DEPARTMENT using DAS config commands)
  • +
  • Advanced features: +
      +
    • Optimistic Concurrency Control (Using BOOK. NAME)
    • +
    • Converter(Using CUSTOMER.LASTNAME)
    • +
    • Result Set Shape(Using CUSTOMER table)
    • +
    +
  • +
+ +

+In future more features will get added. +

+ + +

Running the sample

+ +

+There are two options for running this sample: + +

    +
  • Run from Tomcat configured by the build
  • +
  • Deploying the sample-advanced-webapp WAR into a Tomcat you configure yourself
  • +
+ +

Running from Tomcat configured by the build

+ +

+You need to download the Tuscany RDB DAS source distribution and run maven build to use this option. When you build using maven from the source root {SRC_ROOT} directory, the sample war file is created under {SRC_ROOT}/samples/sample-ajax-das/target. This sample application is deployed to an instance of Tomcat as part of our automated sample testing. For this, follow instructions from reademe.htm from {SRC_ROOT}/samples/testing/tomcat. This will in-effect run the htmlunit tests on the sample. The sample deployed on Tomcat instance will be ready this way and you can just point your browser to http://localhost:8080/sample-advanced-webapp/ to test further. +

+ +

Deploying the sample-ajax-das WAR into a Tomcat you configure yourself

+ +

+Alternatively, you can deploy the sample to your own configured Tomcat installation by following the instructions below.
+These instructions assume that you have either : +

    +
  • 1) Downloaded the Tuscany binary distribution or
  • +
  • 2) Downloaded the Tuscany source and run maven build
  • +
+see the following link to more details steps on how to build DAS Sample applications http://incubator.apache.org/tuscany/das-java-developer-guide.html . +

+ +

Set Up - Derby

+ +
    +
  • Download and install the most recent stable version of Tomcat 5.5 or Tomcat 6. You can find it here: http://tomcat.apache.org/download-60.cgi
  • +
  • Download the most recent official release of Derby from here: http://db.apache.org/derby/index.html. The only file you'll need from this download is derby(version).jar
  • +
  • Stop Tomcat
  • +
  • Copy derby(version).jar (from the derby distribution) to {Tomcat_Home}/common/lib (for Tomcat 5.5) or to {Tomcat_Home}/lib (for Tomcat 6) - e.g. derby-10.2.2.0.jar.
  • +
  • Add the sample war file to {Tomcat_Home}/webapps +
      +
    • sample-advanced-webapp.war
    • +
    +
  • +
  • Define a DataSource by adding a datasource definition to {Tomcat_Home}/conf/server.xml. +
      +
    • Find the end-of-section marker and add the following lines just above it:
    • +
    + +
    +        <!-- Global Datasource for Derby ajaxdastest database -->
    +        <Resource name="jdbc/ajaxdastest"
    +                  type="javax.sql.DataSource" auth="Container"
    +                  description="Derby database for DAS Advanced sample"
    +                  maxActive="100" maxIdle="30" maxWait="10000"
    +                  username="" password=""
    +                  driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
    +                  url="jdbc:derby:{absolute path}Databases/ajaxdastest;create=true"/>
    +        
    + + Requirement: You must include the absolute path to the Databases directory in the above url attribute.
    + Fore example: url="jdbc:derby:c:\apache-tomcat-6.0.13\Databases/ajaxdastest;create=true " +

    +

  • +
  • Start tomcat and point your browser to: http://localhost:8080/sample-advanced-webapp/
  • +
+ +

Set Up - MySQL

+ +
    +
  • Download and install the most recent stable version of Tomcat 5.5 or Tomcat 6. You can find it here: http://tomcat.apache.org/download-60.cgi
  • +
  • Download the most recent official release of MySQL. The only file you'll need from this download is mysql(version).jar (e.g. mysql-connector-java-5.0.4.jar)
  • +
  • Stop Tomcat
  • +
  • Copy mysql(version).jar (from the MySQL distribution) to {Tomcat_Home}/common/lib (for Tomcat 5.5) or to {Tomcat_Home}/lib (for Tomcat 6) - e.g. mysql-connector-java-5.0.4.jar.
  • +
  • Add the sample war file to {Tomcat_Home}/webapps +
      +
    • sample-advanced-webapp.war
    • +
    +
  • +
  • Define a DataSource by adding a datasource definition to {Tomcat_Home}/conf/server.xml. +
      +
    • Find the end-of-section marker and add the following lines just above it:
    • +
    + +
    +        <!-- Global Datasource for MySQL ajaxdastest database -->
    +        <Resource name="jdbc/ajaxdastest"
    +                  type="javax.sql.DataSource" auth="Container"
    +                  description="MySQL database for DAS Advanced sample"
    +                  maxActive="100" maxIdle="30" maxWait="10000"
    +                  username="dastest" password="dastest"
    +                  driverClassName="com.mysql.jdbc.Driver"
    +                  url="jdbc:mysql://localhost/ajaxdastest?createDatabaseIfNotExist=true"/>
    +        
    + + Requirement: MySQL service should be up with configured port open for TCPIP communication. +
    +
    + As the new utility, dbConfig is embedded in this sample war, the MySQL database "dastest" will get created with + required tables and data when the web application gets loaded for the first time in tomcat. Please note that, + in the binary distribution, WEB-INF/classes/CompanyWebDBConfig.xml has SQL Table creation syntax for Derby. + To make it compatible to MySQL, simply replace GENERATED ALWAYS AS IDENTITY with AUTO_INCREMENT for all + table creation statements. (For this unjar the .war, change CompanyWebDBConfig.xml and jar the .war + back with changed CompanyWebDBConfig.xml) +
    +
    +
  • +
  • Start tomcat and point your browser to: http://localhost:8080/sample-advanced-webapp/
  • +
+ + +

Sample Architecture

+ +

The design is modular and reusable by other web samples. There are java servlet, other java classes, jsp, javascript, xml, xsl, css and html files.

+ +

Client Side Files

+ +

Javascripts

+ +

+ +
    +
  • Ajax.js:
    + Ajax.js and dasmenu.js are generic (not DAS specific) and reusable by any web sample.
  • +
  • Dasmenu.js:
    + Set response handler when request is passed to servlet. Response handler's job is transform xml response using xsl into html or plain text based on the example�s requirement.
  • +
+ +

Used for menu/submenu rendering, is quite generic and can be used to display any menu.

+ +

HTMLs & jsps (DAS specific files)

+ +
    +
  • DASMenu.html and DASWebSampleFrame.html are for giving frame and menu to web sample. DASMenu.html calls required .jsps like indexAdhoc.jsp, indexCommand.jsp, occ.jsp, converter.jsp. These jsps are all DAS specific. The .jsp file is responsible for deciding the DAS config file required by current sample and relevant .xsl file.
  • +
+ + +

Serverside files

+ +
    +
  • CommandServlet.java and ServiceProcessor.java
    + Used for invoking required service and returning results back to ajax.js. These files are not DAS specific.
  • + +
  • DASQueryProcessor.java
    + Specific to DAS sample, has logic to invoke required sample example.
  • +
\ No newline at end of file diff --git a/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/DASQueryProcessor.java b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/DASQueryProcessor.java new file mode 100644 index 0000000000..86b83be235 --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/DASQueryProcessor.java @@ -0,0 +1,464 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.samples.das; + +import java.io.InputStream; +import java.lang.reflect.Method; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import java.util.Properties; +import java.util.Random; +import java.util.StringTokenizer; +import java.util.Vector; + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.DAS; +import org.apache.tuscany.das.rdb.exception.OptimisticConcurrencyException; +import org.apache.tuscany.samples.web.ServiceProcessor; + +import commonj.sdo.DataObject; +import commonj.sdo.helper.XMLHelper; + +public class DASQueryProcessor extends ServiceProcessor{ + private DAS das = null; + private Command read = null; + private Random generator = new Random(); + private String configFile = null; + + private static DateFormat myformat = new SimpleDateFormat("yyyy.MM.dd"); + private static Date kbday; + private static Date tbday; + + public String execute(String queryOrcommand, String configFile) throws Exception{ + String status = null; + this.configFile = configFile; + + try{ + Properties props = validate(queryOrcommand); + + if(props != null){ + status = this.getResult((String)props.values().iterator().next(), + (String)props.keys().nextElement()); + } + + if(queryOrcommand.startsWith("occ:")){ + status = this.getOcc(); + } + + if(queryOrcommand.startsWith("converter:")){ + status = this.getConverter(queryOrcommand.substring(10)); + } + + if(queryOrcommand.startsWith("rss:")){ + status = this.getRss(queryOrcommand.substring(4)); + } + }catch(Exception e){ + das.releaseResources(); + e.printStackTrace(); + throw e; + } + das.releaseResources(); + return status ; + } + + private Properties validate(String queryOrcommand) throws Exception{ + if(queryOrcommand == null){ + throw new Exception("Invalid Command URL -> COMMAND is NULL"); + } + + if(queryOrcommand.startsWith("query:")){ + String qry = queryOrcommand.substring(6); + if(qry == null || qry.trim().length() == 0){ + throw new Exception("Invalid Command URL -> COMMAND is NULL"); + } + else{ + Properties props = new Properties(); + props.put("query", qry); + return props; + } + } + + if(queryOrcommand.startsWith("command:")){ + String cmd = queryOrcommand.substring(8); + if(cmd == null || cmd.trim().length() == 0){ + throw new Exception("Invalid Command URL -> COMMAND is NULL"); + } + else{ + Properties props = new Properties(); + props.put("command", cmd); + return props; + } + } + + + return null; + } + + /*For any query starting with query: or command: */ + private String getResult(String qry, String qryOrCommand) throws Exception { + getDAS(); + DataObject root = runCommand(qry, qryOrCommand); + //BOOK, COMPANY, DEPARTMENT, CUSTOMER + Vector elemNames = new Vector(); + if(root.getList("BOOK") != null && root.getList("BOOK").size() >0){ + elemNames.add("BOOK"); + } + if(root.getList("COMPANY") != null && root.getList("COMPANY").size() >0){ + elemNames.add("COMPANY"); + } + if(root.getList("DEPARTMENT") != null && root.getList("DEPARTMENT").size() >0){ + elemNames.add("DEPARTMENT"); + } + if(root.getList("CUSTOMER") != null && root.getList("CUSTOMER").size() >0){ + elemNames.add("CUSTOMER"); + } + + return formatResult(root, elemNames); + + } + + /* Get DAS config */ + private InputStream getConfig(String fileName) { + return getClass().getClassLoader().getResourceAsStream(fileName); + } + + /* Instantiate DAS*/ + private void getDAS(){ + das = DAS.FACTORY.createDAS(getConfig(configFile)); + } + + /*For any query starting with query: or command: */ + private DataObject runCommand(String qry, String qryOrCommand)throws Exception{ + DataObject root = null; + + //adhoc queries + if(qryOrCommand.startsWith("query")){//query can come single or batch, when batch, it will be {}{} + if(!qry.startsWith("{")){ + read = das.createCommand(qry); + root = read.executeQuery(); + } + else{ + Vector batch = formQueries(qry);//separate {}{} in different queries + + if(batch != null){ + for(int i=0; i"; + int idx = xmlStr.indexOf("\n"; + String add1Str = "\n"; + String add2Str = ""; + String addEndStr = " "; + + xmlStr = add0Str+add1Str+add2Str+xmlStr+"\n"+addEndStr; + return xmlStr; + } + + //below has improper serialization due to SDO bugs + /*From DataGraph get contents related to element */ + /*private String xmlizeContent(DataGraph graph) throws Exception{ + ByteArrayOutputStream out = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(out); + oos.writeObject(graph); + oos.flush(); + out.flush(); + //oos.close(); + out.close(); + + //there are UTF-8 chars which are not ISO-8859-1 ones and xsl transformation does not happen due to that + //so filter unwanted. + byte[] graphBytes = out.toByteArray(); + InputStreamReader graphBytesFilter = new InputStreamReader(new ByteArrayInputStream(graphBytes),"ISO-8859-1"); + char[] graphChars = new char[graphBytes.length]; + int curChar = -1; + int j=0; + while((curChar = graphBytesFilter.read()) != -1){ + graphChars[j] = (char)curChar; + j++; + } + + String finalStr = new String(graphChars); + + //remove any junk before first < + finalStr = finalStr.substring(finalStr.indexOf("<"), finalStr.indexOf("")+16); + String xmlSerializationContent = filterJunk(finalStr);//further remove extra characters appearing + System.out.println("xmlSerializationContent:"+xmlSerializationContent); + String xmlContent = XmlUtil.getXmlContents(xmlSerializationContent, "", ""); + System.out.println("xmlContent:"+xmlContent); + return xmlContent; + } + + //for some reason control chars are appearing, need to filter those + //this is ugly solution, need to know why from SDO DataGraph these + //chars are coming in the first place. + private String filterJunk(String inStr){ + char[] myCharArr = inStr.toCharArray(); + StringBuffer strBuf = new StringBuffer(); + + for(int i=0; i=33 && myCharArr[i]<=125) || + Character.isWhitespace(myCharArr[i])){ + strBuf.append(myCharArr[i]); + } + } + return strBuf.toString(); + }*/ + + /* Start CRUD example */ + public DataObject getAllCompanies(String qry) { + read = das.getCommand(qry); + DataObject root = read.executeQuery(); + return root; + } + + public DataObject getAllCompaniesAndDepartments(String qry) { + read = das.getCommand(qry); + DataObject root = read.executeQuery(); + return root; + } + + public DataObject getAddDepartmentToFirstCompany(String qry) { + Command read = das.getCommand("AllCompaniesAndDepartments"); + DataObject root = read.executeQuery(); + DataObject firstCompany = root.getDataObject("COMPANY[1]"); + + DataObject newDepartment = root.createDataObject("DEPARTMENT"); + newDepartment.setString("NAME", "Default Name"); + List deptList = firstCompany.getList("departments"); + + deptList.add(newDepartment); + das.applyChanges(root); + + root = read.executeQuery(); + return root; + } + + public DataObject getDeleteDepartmentFromFirstCompany(String qry) { + Command read = das.getCommand("AllCompaniesAndDepartments"); + DataObject root = read.executeQuery(); + DataObject firstCompany = root.getDataObject("COMPANY[1]"); + + List departments = firstCompany.getList("departments"); + DataObject departmentToDelete = (DataObject)departments.get(departments.size()-1); + departmentToDelete.delete(); + das.applyChanges(root); + root = read.executeQuery(); + return root; + } + + public DataObject getUpdateCompanyDepartmentNames(String qry) { + Command read = das.getCommand("AllCompaniesAndDepartments"); + DataObject root = read.executeQuery(); + DataObject firstCompany = root.getDataObject("COMPANY[1]"); + + Iterator i = firstCompany.getList("departments").iterator(); + + DataObject department; + while (i.hasNext()) { + department = (DataObject) i.next(); + String newName = getRandomDepartmentName(); + department.setString("NAME", newName); + break; + } + das.applyChanges(root); + + root = read.executeQuery(); + return root; + } + + /* @return random new department name */ + private String getRandomDepartmentName() { + int number = generator.nextInt(1000) + 1; + return "Dept-" + number; + } + /*End CRUD example */ + + /*Start OCC example */ + public String getOcc() throws Exception{ + getDAS(); + Command select = das.createCommand("Select * from BOOK where BOOK_ID = 1"); + DataObject root = select.executeQuery(); + // Explicitly update the DB to force a collision + Command update = das.createCommand("update BOOK set NAME = 'Puss in Hat' where BOOK_ID = 1"); + update.execute(); + DataObject book = root.getDataObject("BOOK[1]"); + + // Modify customer + book.set("NAME", "Puss in Bat"); + + // Build apply changes command + try { + das.applyChanges(root); + } catch (OptimisticConcurrencyException ex) { + if (!ex.getMessage().equals("An update collision occurred")) { + throw ex; + } + else{ + return ex.getMessage(); + } + } + return "Success"; + } + /* End OCC example */ + + /* Start Result Set Shape example*/ + public String getRss(String stmt) throws Exception{ + getDAS(); + read = das.getCommand(stmt); + //Read + DataObject root = read.executeQuery(); + Vector elemNames = new Vector(); + elemNames.add("CUSTOMER"); + return formatResult(root, elemNames); + } + /* End Result Set Shape example*/ + + /*Converter example start*/ + static { + try { + kbday = myformat.parse("1957.09.27"); + tbday = myformat.parse("1966.12.20"); + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + + public String getConverter(String stmt) throws Exception{ + getDAS(); + read = das.getCommand("testArbitraryConverter"); + //Read + DataObject root = read.executeQuery(); + + if(stmt.equals("stmt0")){//Select * from CUSTOMER where ID = 1; + Vector elemNames = new Vector(); + elemNames.add("CUSTOMER"); + return this.formatResult(root, elemNames); + } + + if(stmt.equals("stmt1")){//Check First Customer's LastName is 1957.09.27 + return myformat.format(root.getDate("CUSTOMER[1]/LASTNAME")); + } + + if(stmt.equals("stmt2")||stmt.equals("stmt3")){//Set First Customer's LastName to 1966.12.20 OR + //Check First Customer's LastName is 1966.12.20 + root.setDate("CUSTOMER[1]/LASTNAME", tbday); + das.applyChanges(root); + // Read + root = read.executeQuery(); + return myformat.format(root.getDate("CUSTOMER[1]/LASTNAME")); + } + + return null; + } + /* Converter example end**/ + + /*For test*/ + public static void main(String[] args){ + DASQueryProcessor qryProc = new DASQueryProcessor(); + try{ + qryProc.execute("command:AllCompaniesAndDepartments", "DasConfig.xml"); + }catch(Exception e){ + e.printStackTrace(); + } + + } + +} diff --git a/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/SillyDateStringConverter.java b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/SillyDateStringConverter.java new file mode 100644 index 0000000000..f1fe21cfd4 --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/SillyDateStringConverter.java @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.samples.das; + +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 { + + private static DateFormat myformat = new SimpleDateFormat("yyyy.MM.dd"); + + private static Date kbday; + + private static Date tbday; + + public SillyDateStringConverter() { + super(); + } + + 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("Pavick")) { + return kbday; + } + + if (columnData.equals("Williams")) { + return tbday; + } + + throw new IllegalArgumentException(); + + } + + public Object getColumnValue(Object propertyData) { + if (propertyData.equals(kbday)) { + return "Pavick"; + } + + if (propertyData.equals(tbday)) { + return "Williams"; + } + + throw new IllegalArgumentException(); + + } + +} diff --git a/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/StringToLongConverter.java b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/StringToLongConverter.java new file mode 100644 index 0000000000..fc26164191 --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/StringToLongConverter.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.samples.das; + +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/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/util/XmlUtil.java b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/util/XmlUtil.java new file mode 100644 index 0000000000..9a615fa33c --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/util/XmlUtil.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.samples.das.util; +/** + * + * XML utilities + * + */ +public class XmlUtil { + /** + * From the complete serialized DataGraph, get the required portion + *relevant to element. + */ + public static String getXmlContents(String xmlString, String xmlStartElement, String xmlEndElement){ + int posStartElement = xmlString.indexOf(xmlStartElement); + int posEndElement = xmlString.indexOf(xmlEndElement) ; + + //check if startElement was not found + if(posStartElement == -1) + posStartElement = 0; + + //check if endElement was not found + if(posEndElement == -1) + posEndElement = xmlString.length(); + else + //fixup the posEndElement to return the closing element tag + posEndElement += + xmlEndElement.length(); + + //return xml contents for the requested element + String xmlBody = xmlString.substring(posStartElement, posEndElement); + + + String result = + " \n"+ + " \n"+ + xmlBody+" "; + + return result; + } + +} diff --git a/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/CommandServlet.java b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/CommandServlet.java new file mode 100644 index 0000000000..ffab0d107b --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/CommandServlet.java @@ -0,0 +1,160 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.samples.web; + +import java.io.IOException; + +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.tuscany.das.rdb.dbconfig.DBInitializer; +/** + * This is generic servlet where based on serviceName, it will call the speciliazed processor to + * process request and obtain response. This servlet can be used in any web sample, just needs to + * pass appropriate serviceProcessorClassName and rest is generic + * + */ +public class CommandServlet extends HttpServlet { + final static long serialVersionUID = 1221332432; + /* + * (non-Java-doc) + * + * @see javax.servlet.http.HttpServlet#HttpServlet() + */ + public CommandServlet() { + super(); + } + + public static void refreshDB() throws ServletException { + try{ + DBInitializer dbInitializer = new DBInitializer("AjaxDBConfig.xml"); + dbInitializer.refreshDatabaseData(); + }catch(Exception e){ + e.printStackTrace(); + ServletException se = new ServletException(e.getMessage()); + throw se; + } + } + + public void init(ServletConfig config) throws ServletException { + refreshDB(); + } + + /* + * (non-Java-doc) + * + * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest arg0, + * HttpServletResponse arg1) + */ + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + doTask(request, response); + } + + /* + * (non-Java-doc) + * + * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest arg0, + * HttpServletResponse arg1) + */ + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + doTask(request, response); + } + + /**Invoke passed service and return result + * + * @param req + * @param resp + * @throws ServletException + * @throws IOException + */ + public void doTask(HttpServletRequest req, HttpServletResponse resp) + throws ServletException, IOException { + String textContentType= "text/text"; + String xmlContentType= "text/xml"; + + String refreshRequest = req.getParameter("refreshDB"); + if(refreshRequest != null && refreshRequest.equals("yes")){ + { + try{ + refreshDB(); + }catch(ServletException e){ + throw e; + } + } + this.writeResponse(resp, "Refreshed database!", textContentType); + } + else{ + String serviceName = req.getParameter("serviceName");//e.g. DASQueryProcessor + String qry = req.getParameter("Query");//e.g. query:xxx, command:yyy + String configFile = req.getParameter("configFile");//name of DAS config file + + try{ + ServiceProcessor serviceClassInst = null; + //so any subclass of abstract ServiceProcessor can be used + Object obj = Class.forName(serviceName).newInstance(); + + if(obj instanceof ServiceProcessor){ + serviceClassInst = (ServiceProcessor)obj; + } + + String result = serviceClassInst.execute(qry, configFile); + this.writeResponse(resp, result, xmlContentType); + }catch(Exception e){ + this.writeResponse(resp, e.getMessage(), textContentType); + e.printStackTrace(); + } + } + } + + /**Write response in required content type to servlet response + * + * @param resp + * @param output + * @param contentType + * @throws IOException + */ + public void writeResponse(HttpServletResponse resp, String output, String contentType) throws IOException { + resp.setContentType(contentType);//"text/text", "text/xml" + resp.setHeader("Cache-Control", "no-cache"); + resp.getWriter().write(output); + } + + // Utility methods + + public void gotoURL(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String url) throws ServletException, IOException { + url = response.encodeURL(url); + RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url); + dispatcher.forward(request, response); + } + + public void redirectURL(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String url) throws ServletException, IOException { + url = response.encodeURL(request.getContextPath() + url); + response.sendRedirect(url); + } + + public void forwardURL(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String url) throws ServletException, IOException { + url = response.encodeURL(url); + RequestDispatcher dispatch = getServletContext().getRequestDispatcher(url); + dispatch.forward(request, response); + } +} diff --git a/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/ServiceProcessor.java b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/ServiceProcessor.java new file mode 100644 index 0000000000..aefebb8808 --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/ServiceProcessor.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.samples.web; + +//generic processor +public abstract class ServiceProcessor { + public abstract String execute(String command, String configFile) throws Exception; +} diff --git a/das-java/trunk/samples/advanced-webapp/src/main/resources/AjaxDBConfig.xml b/das-java/trunk/samples/advanced-webapp/src/main/resources/AjaxDBConfig.xml new file mode 100644 index 0000000000..f172c089c9 --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/resources/AjaxDBConfig.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + 'ACME Publishing' + 'Do-rite plumbing' + 'MegaCorp' +
+ + + 'Advanced Technologies', 'NY', '123', 1 +
+ + + 1, 'Pavick', 'CA' + 2, 'Williams', 'NJ' +
+ + + 1, 'The Brothers Karamazov', 'Fyodor Dostoevsky',5, 17 +
+ +
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/resources/CustomerConfigWithConverter.xml b/das-java/trunk/samples/advanced-webapp/src/main/resources/CustomerConfigWithConverter.xml new file mode 100644 index 0000000000..0ef0c5b9b1 --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/resources/CustomerConfigWithConverter.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + +
+ +
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/resources/CustomerConfigWithIDConverter.xml b/das-java/trunk/samples/advanced-webapp/src/main/resources/CustomerConfigWithIDConverter.xml new file mode 100644 index 0000000000..f26082a340 --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/resources/CustomerConfigWithIDConverter.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + +
+ +
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/resources/DasConfig.xml b/das-java/trunk/samples/advanced-webapp/src/main/resources/DasConfig.xml new file mode 100644 index 0000000000..69ac31895c --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/resources/DasConfig.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + + + + +
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/LICENSE b/das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/LICENSE new file mode 100644 index 0000000000..fb4df3722c --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/LICENSE @@ -0,0 +1,353 @@ + + 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. + +=============================================================================================================== + +Other components and dependencies under Apache Software License 2.0 : + + log4j-1.2.14.jar - Apache Logging Services + derby 10.2.2.0.jar - Apache Derby + stax-api-1.0.1.jar - The Streaming API for XML (StAX) + wstx-asl-3.2.0.jar - WoodStox StAX implementation + standard-1.1.1.jar - The Apache Jackarta Taglibs + jstl-1.1.2.jar - The Apache Jackarta Taglibs + *.tld - The Apache Jackarta Taglibs + +=============================================================================================================== + + +Apache Tuscany SDO for Java Subcomponents +=========================================: + +The Tuscany SDO for Java release 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. + +License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar) + +Permission to copy, make derivative works of, and distribute the Service Data Objects +JavaDoc and Interface Definition Files files in any medium without fee or royalty as part +of a compliant implementation of the Service Data Objects Specification is hereby granted. +The Service Data Objects Specification may be found at any of the following locations: + +http://dev2dev.bea.com/technologies/commonj/index.jsp +http://www.ibm.com/developerworks/library/specification/ws-sdo/ +http://oracle.com/technology/webservices/sca +https://www.sdn.sap.com/ +http://www.xcalia/xdn/specs/sdo + +THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES +ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS +SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS, +INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE +SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES. + +The name and trademarks of the Authors may NOT be used in any manner, including advertising or +publicity pertaining to the Service Component Architecture Specification or its contents without specific, +written prior permission. Title to copyright in the Service Data Objects Specification and the +JavaDoc and Interface Definition Files will at all times remain with the Authors. + +No other rights are granted by implication, estoppel or otherwise. + +================================================================================================================= + +For the Eclipse EMF components +(codegen-2.2.3.jar +codegen-ecore-2.2.3.jar +common-2.2.3.jar +ecore-2.2.3.jar +ecore-change-2.2.3.jar +ecore-xmi-2.2.3.jar +xsd-2.2.3.jar) + +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. + +=================================================================================================== diff --git a/das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/NOTICE b/das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..c2cf1f95b4 --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/NOTICE @@ -0,0 +1,32 @@ +Apache Tuscany SDO for Java +Copyright 2006, 2007 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF), +sponsored by the Apache 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. + +Unless otherwise indicated, all distribution made available by the Apache Software Foundation +is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL"). +A copy of the AL is provided with this distribution as the LICENSE.txt file present in the +root directory, and is also available at http://www.apache.org/licenses/. + +The terms and conditions governing the distribution may refer to the AL or other license +agreements, notices or terms and conditions. Some of these other license agreements may +include (but are not limited to): + + . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html) + +It is your obligation to read and accept all such terms and conditions prior to use of the +distribution. If term or condition is provided, please contact the Apache Software Foundation +to determine what terms and conditions govern that particular distribution. + +This product also includes software developed by the Open Service Oriented Architecture organisation +(http://osoa.org). The license for this software may be found in the LICENSE.txt file contained in this +distribution. diff --git a/das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/README b/das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/README new file mode 100644 index 0000000000..d1905ee3e8 --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/resources/META-INF/README @@ -0,0 +1,35 @@ +Apache Tuscany M2 build (October, 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/das-java/trunk/samples/advanced-webapp/src/main/resources/log4j.properties b/das-java/trunk/samples/advanced-webapp/src/main/resources/log4j.properties new file mode 100644 index 0000000000..7f18e4dc72 --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/resources/log4j.properties @@ -0,0 +1,36 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# +# Set root logger level to DEBUG and its only appender to A1. +log4j.rootLogger=INFO, NULL + +# NULL Appender +log4j.appender.NULL=org.apache.log4j.varia.NullAppender + +log4j.appender.NULL.layout=org.apache.log4j.PatternLayout +log4j.appender.NULL.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n + +# CONSOLE is set to be a ConsoleAppender. +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n + + +# Print only messages of level WARN or above in the package com.foo. +log4j.logger.org.apache.tuscany=NONE \ No newline at end of file diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/META-INF/context.xml b/das-java/trunk/samples/advanced-webapp/src/main/webapp/META-INF/context.xml new file mode 100644 index 0000000000..e2da613636 --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/META-INF/context.xml @@ -0,0 +1,22 @@ + + + + + + + + diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/c.tld b/das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/c.tld new file mode 100644 index 0000000000..22698c97dc --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/c.tld @@ -0,0 +1,563 @@ + + + + + JSTL 1.1 core library + JSTL core + 1.1 + c + http://java.sun.com/jsp/jstl/core + + + + Provides core validation features for JSTL tags. + + + org.apache.taglibs.standard.tlv.JstlCoreTLV + + + + + + Catches any Throwable that occurs in its body and optionally + exposes it. + + catch + org.apache.taglibs.standard.tag.common.core.CatchTag + JSP + + +Name of the exported scoped variable for the +exception thrown from a nested action. The type of the +scoped variable is the type of the exception thrown. + + var + false + false + + + + + + Simple conditional tag that establishes a context for + mutually exclusive conditional operations, marked by + <when> and <otherwise> + + choose + org.apache.taglibs.standard.tag.common.core.ChooseTag + JSP + + + + + Simple conditional tag, which evalutes its body if the + supplied condition is true and optionally exposes a Boolean + scripting variable representing the evaluation of this condition + + if + org.apache.taglibs.standard.tag.rt.core.IfTag + JSP + + +The test condition that determines whether or +not the body content should be processed. + + test + true + true + boolean + + + +Name of the exported scoped variable for the +resulting value of the test condition. The type +of the scoped variable is Boolean. + + var + false + false + + + +Scope for var. + + scope + false + false + + + + + + Retrieves an absolute or relative URL and exposes its contents + to either the page, a String in 'var', or a Reader in 'varReader'. + + import + org.apache.taglibs.standard.tag.rt.core.ImportTag + org.apache.taglibs.standard.tei.ImportTEI + JSP + + +The URL of the resource to import. + + url + true + true + + + +Name of the exported scoped variable for the +resource's content. The type of the scoped +variable is String. + + var + false + false + + + +Scope for var. + + scope + false + false + + + +Name of the exported scoped variable for the +resource's content. The type of the scoped +variable is Reader. + + varReader + false + false + + + +Name of the context when accessing a relative +URL resource that belongs to a foreign +context. + + context + false + true + + + +Character encoding of the content at the input +resource. + + charEncoding + false + true + + + + + + The basic iteration tag, accepting many different + collection types and supporting subsetting and other + functionality + + forEach + org.apache.taglibs.standard.tag.rt.core.ForEachTag + org.apache.taglibs.standard.tei.ForEachTEI + JSP + + +Collection of items to iterate over. + + items + false + true + java.lang.Object + + + +If items specified: +Iteration begins at the item located at the +specified index. First item of the collection has +index 0. +If items not specified: +Iteration begins with index set at the value +specified. + + begin + false + true + int + + + +If items specified: +Iteration ends at the item located at the +specified index (inclusive). +If items not specified: +Iteration ends when index reaches the value +specified. + + end + false + true + int + + + +Iteration will only process every step items of +the collection, starting with the first one. + + step + false + true + int + + + +Name of the exported scoped variable for the +current item of the iteration. This scoped +variable has nested visibility. Its type depends +on the object of the underlying collection. + + var + false + false + + + +Name of the exported scoped variable for the +status of the iteration. Object exported is of type +javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested +visibility. + + varStatus + false + false + + + + + + Iterates over tokens, separated by the supplied delimeters + + forTokens + org.apache.taglibs.standard.tag.rt.core.ForTokensTag + JSP + + +String of tokens to iterate over. + + items + true + true + java.lang.String + + + +The set of delimiters (the characters that +separate the tokens in the string). + + delims + true + true + java.lang.String + + + +Iteration begins at the token located at the +specified index. First token has index 0. + + begin + false + true + int + + + +Iteration ends at the token located at the +specified index (inclusive). + + end + false + true + int + + + +Iteration will only process every step tokens +of the string, starting with the first one. + + step + false + true + int + + + +Name of the exported scoped variable for the +current item of the iteration. This scoped +variable has nested visibility. + + var + false + false + + + +Name of the exported scoped variable for the +status of the iteration. Object exported is of +type +javax.servlet.jsp.jstl.core.LoopTag +Status. This scoped variable has nested +visibility. + + varStatus + false + false + + + + + + Like <%= ... >, but for expressions. + + out + org.apache.taglibs.standard.tag.rt.core.OutTag + JSP + + +Expression to be evaluated. + + value + true + true + + + +Default value if the resulting value is null. + + default + false + true + + + +Determines whether characters <,>,&,'," in the +resulting string should be converted to their +corresponding character entity codes. Default value is +true. + + escapeXml + false + true + + + + + + + Subtag of <choose> that follows <when> tags + and runs only if all of the prior conditions evaluated to + 'false' + + otherwise + org.apache.taglibs.standard.tag.common.core.OtherwiseTag + JSP + + + + + Adds a parameter to a containing 'import' tag's URL. + + param + org.apache.taglibs.standard.tag.rt.core.ParamTag + JSP + + +Name of the query string parameter. + + name + true + true + + + +Value of the parameter. + + value + false + true + + + + + + Redirects to a new URL. + + redirect + org.apache.taglibs.standard.tag.rt.core.RedirectTag + JSP + + +The URL of the resource to redirect to. + + url + false + true + + + +Name of the context when redirecting to a relative URL +resource that belongs to a foreign context. + + context + false + true + + + + + + Removes a scoped variable (from a particular scope, if specified). + + remove + org.apache.taglibs.standard.tag.common.core.RemoveTag + empty + + +Name of the scoped variable to be removed. + + var + true + false + + + +Scope for var. + + scope + false + false + + + + + + Sets the result of an expression evaluation in a 'scope' + + set + org.apache.taglibs.standard.tag.rt.core.SetTag + JSP + + +Name of the exported scoped variable to hold the value +specified in the action. The type of the scoped variable is +whatever type the value expression evaluates to. + + var + false + false + + + +Expression to be evaluated. + + value + false + true + + + +Target object whose property will be set. Must evaluate to +a JavaBeans object with setter property property, or to a +java.util.Map object. + + target + false + true + + + +Name of the property to be set in the target object. + + property + false + true + + + +Scope for var. + + scope + false + false + + + + + + Creates a URL with optional query parameters. + + url + org.apache.taglibs.standard.tag.rt.core.UrlTag + JSP + + +Name of the exported scoped variable for the +processed url. The type of the scoped variable is +String. + + var + false + false + + + +Scope for var. + + scope + false + false + + + +URL to be processed. + + value + false + true + + + +Name of the context when specifying a relative URL +resource that belongs to a foreign context. + + context + false + true + + + + + + Subtag of <choose> that includes its body if its + condition evalutes to 'true' + + when + org.apache.taglibs.standard.tag.rt.core.WhenTag + JSP + + +The test condition that determines whether or not the +body content should be processed. + + test + true + true + boolean + + + + diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/fmt.tld b/das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/fmt.tld new file mode 100644 index 0000000000..3b9a54a87d --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/fmt.tld @@ -0,0 +1,671 @@ + + + + + JSTL 1.1 i18n-capable formatting library + JSTL fmt + 1.1 + fmt + http://java.sun.com/jsp/jstl/fmt + + + + Provides core validation features for JSTL tags. + + + org.apache.taglibs.standard.tlv.JstlFmtTLV + + + + + + Sets the request character encoding + + requestEncoding + org.apache.taglibs.standard.tag.rt.fmt.RequestEncodingTag + empty + + +Name of character encoding to be applied when +decoding request parameters. + + value + false + true + + + + + + Stores the given locale in the locale configuration variable + + setLocale + org.apache.taglibs.standard.tag.rt.fmt.SetLocaleTag + empty + + +A String value is interpreted as the +printable representation of a locale, which +must contain a two-letter (lower-case) +language code (as defined by ISO-639), +and may contain a two-letter (upper-case) +country code (as defined by ISO-3166). +Language and country codes must be +separated by hyphen (-) or underscore +(_). + + value + true + true + + + +Vendor- or browser-specific variant. +See the java.util.Locale javadocs for +more information on variants. + + variant + false + true + + + +Scope of the locale configuration variable. + + scope + false + false + + + + + + Specifies the time zone for any time formatting or parsing actions + nested in its body + + timeZone + org.apache.taglibs.standard.tag.rt.fmt.TimeZoneTag + JSP + + +The time zone. A String value is interpreted as +a time zone ID. This may be one of the time zone +IDs supported by the Java platform (such as +"America/Los_Angeles") or a custom time zone +ID (such as "GMT-8"). See +java.util.TimeZone for more information on +supported time zone formats. + + value + true + true + + + + + + Stores the given time zone in the time zone configuration variable + + setTimeZone + org.apache.taglibs.standard.tag.rt.fmt.SetTimeZoneTag + empty + + +The time zone. A String value is interpreted as +a time zone ID. This may be one of the time zone +IDs supported by the Java platform (such as +"America/Los_Angeles") or a custom time zone +ID (such as "GMT-8"). See java.util.TimeZone for +more information on supported time zone +formats. + + value + true + true + + + +Name of the exported scoped variable which +stores the time zone of type +java.util.TimeZone. + + var + false + false + + + +Scope of var or the time zone configuration +variable. + + scope + false + false + + + + + + Loads a resource bundle to be used by its tag body + + bundle + org.apache.taglibs.standard.tag.rt.fmt.BundleTag + JSP + + +Resource bundle base name. This is the bundle's +fully-qualified resource name, which has the same +form as a fully-qualified class name, that is, it uses +"." as the package component separator and does not +have any file type (such as ".class" or ".properties") +suffix. + + basename + true + true + + + +Prefix to be prepended to the value of the message +key of any nested <fmt:message> action. + + prefix + false + true + + + + + + Loads a resource bundle and stores it in the named scoped variable or + the bundle configuration variable + + setBundle + org.apache.taglibs.standard.tag.rt.fmt.SetBundleTag + empty + + +Resource bundle base name. This is the bundle's +fully-qualified resource name, which has the same +form as a fully-qualified class name, that is, it uses +"." as the package component separator and does not +have any file type (such as ".class" or ".properties") +suffix. + + basename + true + true + + + +Name of the exported scoped variable which stores +the i18n localization context of type +javax.servlet.jsp.jstl.fmt.LocalizationC +ontext. + + var + false + false + + + +Scope of var or the localization context +configuration variable. + + scope + false + false + + + + + + Maps key to localized message and performs parametric replacement + + message + org.apache.taglibs.standard.tag.rt.fmt.MessageTag + JSP + + +Message key to be looked up. + + key + false + true + + + +Localization context in whose resource +bundle the message key is looked up. + + bundle + false + true + + + +Name of the exported scoped variable +which stores the localized message. + + var + false + false + + + +Scope of var. + + scope + false + false + + + + + + Supplies an argument for parametric replacement to a containing + <message> tag + + param + org.apache.taglibs.standard.tag.rt.fmt.ParamTag + JSP + + +Argument used for parametric replacement. + + value + false + true + + + + + + Formats a numeric value as a number, currency, or percentage + + formatNumber + org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag + JSP + + +Numeric value to be formatted. + + value + false + true + + + +Specifies whether the value is to be +formatted as number, currency, or +percentage. + + type + false + true + + + +Custom formatting pattern. + + pattern + false + true + + + +ISO 4217 currency code. Applied only +when formatting currencies (i.e. if type is +equal to "currency"); ignored otherwise. + + currencyCode + false + true + + + +Currency symbol. Applied only when +formatting currencies (i.e. if type is equal +to "currency"); ignored otherwise. + + currencySymbol + false + true + + + +Specifies whether the formatted output +will contain any grouping separators. + + groupingUsed + false + true + + + +Maximum number of digits in the integer +portion of the formatted output. + + maxIntegerDigits + false + true + + + +Minimum number of digits in the integer +portion of the formatted output. + + minIntegerDigits + false + true + + + +Maximum number of digits in the +fractional portion of the formatted output. + + maxFractionDigits + false + true + + + +Minimum number of digits in the +fractional portion of the formatted output. + + minFractionDigits + false + true + + + +Name of the exported scoped variable +which stores the formatted result as a +String. + + var + false + false + + + +Scope of var. + + scope + false + false + + + + + + Parses the string representation of a number, currency, or percentage + + parseNumber + org.apache.taglibs.standard.tag.rt.fmt.ParseNumberTag + JSP + + +String to be parsed. + + value + false + true + + + +Specifies whether the string in the value +attribute should be parsed as a number, +currency, or percentage. + + type + false + true + + + +Custom formatting pattern that determines +how the string in the value attribute is to be +parsed. + + pattern + false + true + + + +Locale whose default formatting pattern (for +numbers, currencies, or percentages, +respectively) is to be used during the parse +operation, or to which the pattern specified +via the pattern attribute (if present) is +applied. + + parseLocale + false + true + + + +Specifies whether just the integer portion of +the given value should be parsed. + + integerOnly + false + true + + + +Name of the exported scoped variable which +stores the parsed result (of type +java.lang.Number). + + var + false + false + + + +Scope of var. + + scope + false + false + + + + + + Formats a date and/or time using the supplied styles and pattern + + formatDate + org.apache.taglibs.standard.tag.rt.fmt.FormatDateTag + empty + + +Date and/or time to be formatted. + + value + true + true + + + +Specifies whether the time, the date, or both +the time and date components of the given +date are to be formatted. + + type + false + true + + + +Predefined formatting style for dates. Follows +the semantics defined in class +java.text.DateFormat. Applied only +when formatting a date or both a date and +time (i.e. if type is missing or is equal to +"date" or "both"); ignored otherwise. + + dateStyle + false + true + + + +Predefined formatting style for times. Follows +the semantics defined in class +java.text.DateFormat. Applied only +when formatting a time or both a date and +time (i.e. if type is equal to "time" or "both"); +ignored otherwise. + + timeStyle + false + true + + + +Custom formatting style for dates and times. + + pattern + false + true + + + +Time zone in which to represent the formatted +time. + + timeZone + false + true + + + +Name of the exported scoped variable which +stores the formatted result as a String. + + var + false + false + + + +Scope of var. + + scope + false + false + + + + + + Parses the string representation of a date and/or time + + parseDate + org.apache.taglibs.standard.tag.rt.fmt.ParseDateTag + JSP + + +Date string to be parsed. + + value + false + true + + + +Specifies whether the date string in the +value attribute is supposed to contain a +time, a date, or both. + + type + false + true + + + +Predefined formatting style for days +which determines how the date +component of the date string is to be +parsed. Applied only when formatting a +date or both a date and time (i.e. if type +is missing or is equal to "date" or "both"); +ignored otherwise. + + dateStyle + false + true + + + +Predefined formatting styles for times +which determines how the time +component in the date string is to be +parsed. Applied only when formatting a +time or both a date and time (i.e. if type +is equal to "time" or "both"); ignored +otherwise. + + timeStyle + false + true + + + +Custom formatting pattern which +determines how the date string is to be +parsed. + + pattern + false + true + + + +Time zone in which to interpret any time +information in the date string. + + timeZone + false + true + + + +Locale whose predefined formatting styles +for dates and times are to be used during +the parse operation, or to which the +pattern specified via the pattern +attribute (if present) is applied. + + parseLocale + false + true + + + +Name of the exported scoped variable in +which the parsing result (of type +java.util.Date) is stored. + + var + false + false + + + +Scope of var. + + scope + false + false + + + + diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/web.xml b/das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..c60d36566b --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,46 @@ + + + + + + Tuscany DAS Features + + html/DASWebSampleFrame.html + + + + + CommandServlet + CommandServlet + org.apache.tuscany.samples.web.CommandServlet + + + CommandServlet + /CommandServlet + + + + + http://java.sun.com/jstl/core + /WEB-INF/tld/c.tld + + + http://java.sun.com/jstl/fmt + /WEB-INF/tld/fmt.tld + + diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/html/DASWebSampleFrame.html b/das-java/trunk/samples/advanced-webapp/src/main/webapp/html/DASWebSampleFrame.html new file mode 100644 index 0000000000..49f913eaec --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/html/DASWebSampleFrame.html @@ -0,0 +1,27 @@ + + + + + +Tuscany DAS Web Sample + + + + + + \ No newline at end of file diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/html/blank.html b/das-java/trunk/samples/advanced-webapp/src/main/webapp/html/blank.html new file mode 100644 index 0000000000..0bc2a49864 --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/html/blank.html @@ -0,0 +1,25 @@ + + + + + + + + + + \ No newline at end of file diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/js/ajax.js b/das-java/trunk/samples/advanced-webapp/src/main/webapp/js/ajax.js new file mode 100644 index 0000000000..c0b0be5e54 --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/js/ajax.js @@ -0,0 +1,188 @@ +// + +var req; +var url; +var xslFileName; +var brwsr; +var htmlunitlimit; + +function startup(pageName) { + if(pageName == 'adhoc'){ + document.forms[0].sqlQuery.focus = true; + } + + if(pageName == 'command') { + document.forms[0].DasCommand.focus = true; + } +} + +function init() { + if (window.XMLHttpRequest) { + brwsr="NOIE"; + req = new XMLHttpRequest(); + } else if (window.ActiveXObject) { + brwsr="IE"; + req = new ActiveXObject("Microsoft.XMLHTTP"); + } + var url = "../CommandServlet"; + req.open("POST", url, true); + req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); +} + +function formWaitMessage(){ + var swappableSection = document.getElementById('msg'); + if (window.XSLTProcessor) + { + swappableSection.innerHTML = ''; + var x = document.createTextNode('Retreiving result..please wait'); + swappableSection.appendChild(x); + } + else if(window.ActiveXObject) + { + swappableSection.innerHTML = 'Retreiving result..please wait' ; + } +} + +function executeQuery(reqParams, xslFileNameVal) { + init(); + req.onreadystatechange = resultHandler; + xslFileName = xslFileNameVal; + //alert(reqParams); + xsldocloaded = false; + loadXsl(); + req.send(reqParams); + //alert('req sent'); +} + + var xsldocloaded = false; + var xsldoc; + +function loadXsl(){ + if(xslFileName != ''){ + if (window.XSLTProcessor) + { + // support Mozilla/Gecko based browsers + xsldoc = document.implementation.createDocument("", "", null); + xsldoc.addEventListener("load", onXslLoad, false); + xsldoc.load(xslFileName); + //alert("done loadXsl Mozilla"); + htmlunitlimit='false'; + } + else if(window.ActiveXObject) + { + // support Windows / ActiveX + xsldoc = new ActiveXObject("Microsoft.XMLDOM"); + xsldoc.ondataavailable = onXslLoad; + xsldoc.load(xslFileName); + //alert("done loadXsl IE"); + htmlunitlimit='false'; + } + else{ + //alert('setiing htmlunitlimit true'); + htmlunitlimit='true'; + } + } +} + +function onXslLoad() +{ + // flag that the xsl is loaded + xsldocloaded = true; +} + +function resultHandler() +{ + // Make sure the request is loaded (readyState = 4) + if (req.readyState == 4) + { + // Make sure the status is "OK" + if (req.status == 200) + { + // Make sure the XSL document is loaded + if (!xsldocloaded && xslFileName != '') + { + if(htmlunitlimit=='false'){ + alert("Unable to transform data. XSL is not yet loaded."); + // break out of the function + return; + } + else{ + var swappableSectionUT = document.getElementById('msg'); + if(brwsr=='NOIE'){ + //alert('limit case, xsl present, noie'); + swappableSectionUT.removeChild(swappableSectionUT.childNodes[0]);//remove wait message + var x = document.createTextNode(req.responseText); + swappableSectionUT.appendChild(x); + } + else{ + swappableSectionUT.innerHTML = req.responseText; + } + //alert('returning result:'+req.responseText); + return; + } + } + + var swappableSection = document.getElementById("msg"); + + if (window.XSLTProcessor) + { + if(xslFileName == ''){ + swappableSection.removeChild(swappableSection.childNodes[0]);//remove wait message + var x = document.createTextNode(req.responseText); + swappableSection.appendChild(x); + } + else{ + // support Mozilla/Gecko based browsers + var xsltProcessor = new XSLTProcessor(); + xsltProcessor.importStylesheet(xsldoc); + var outputXHTML = xsltProcessor + .transformToFragment(req.responseXML, document); + swappableSection.innerHTML = ""; + swappableSection.appendChild(outputXHTML); + } + } + else if(window.ActiveXObject) + { + if(xslFileName == ''){ + swappableSection.innerHTML = req.responseText; + } + else{ + // support Windows/ActiveX enabled browsers + var outputXHTML = req.responseXML.transformNode(xsldoc); + swappableSection.innerHTML = outputXHTML; + } + } + else{ + var swappableSectionUT = document.getElementById('msg'); + if(brwsr=='NOIE'){ + swappableSectionUT.removeChild(swappableSectionUT.childNodes[0]);//remove wait message + var x = document.createTextNode(req.responseText); + swappableSectionUT.appendChild(x); + } + else{ + swappableSectionUT.innerHTML = req.responseText; + } + return; + } + } + else + { + alert("There was a problem retrieving the XML data:\n" + + req.statusText); + } + } +} diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/js/dasmenu.js b/das-java/trunk/samples/advanced-webapp/src/main/webapp/js/dasmenu.js new file mode 100644 index 0000000000..96b5d5288e --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/js/dasmenu.js @@ -0,0 +1,112 @@ +// +var dbstatus; +var brwsrDB; +var reqDB; + +function showSubMenu(){ + var objThis = this; + + for(var i = 0; i < objThis.childNodes.length; i++) + { + if(objThis.childNodes.item(i).nodeName == "UL") + { + objThis.childNodes.item(i).style.display = "block"; + } + } +} + +function hideSubMenu() +{ + var objThis = this; + + for(var i = 0; i < objThis.childNodes.length; i++) + { + if(objThis.childNodes.item(i).nodeName == "UL") + { + objThis.childNodes.item(i).style.display = "none"; + return; + } + } +} + +function initialiseMenu() +{ + var objLICollection = document.body.getElementsByTagName("LI"); + for(var i = 0; i < objLICollection.length; i++) + { + var objLI = objLICollection[i]; + for(var j = 0; j < objLI.childNodes.length; j++) + { + if(objLI.childNodes.item(j).nodeName == "UL") + { + objLI.onmouseover=showSubMenu; + objLI.onmouseout=hideSubMenu; + + for(var j = 0; j < objLI.childNodes.length; j++) + { + if(objLI.childNodes.item(j).nodeName == "A") + { + objLI.childNodes.item(j).className = "hassubmenu"; + } + } + } + } + } +} + +function refreshdb(){ + if (window.XMLHttpRequest) { + brwsrDB='NOIE'; + reqDB = new XMLHttpRequest(); + } else if (window.ActiveXObject) { + brwsrDB='IE'; + reqDB = new ActiveXObject("Microsoft.XMLHTTP"); + } + + var dbRefreshMsg = document.getElementById('dbmsg'); + if(brwsrDB=='NOIE'){ + var x = document.createTextNode('Refreshing database..please wait'); + dbRefreshMsg.appendChild(x); + } + else{ + dbmsg.innerHTML = 'Refreshing database..please wait'; + } + + //TODO + var urlDB = "../CommandServlet"; + reqDB.open("POST", urlDB, true); + reqDB.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + reqDB.onreadystatechange = dbresultHandler; + reqDB.send('refreshDB=yes'); +} + +function dbresultHandler() { + if (reqDB.readyState == 4) { + if (reqDB.status == 200) { + var dbRefreshMsg = document.getElementById('dbmsg'); + if(brwsrDB=='NOIE'){ + dbRefreshMsg.removeChild(dbRefreshMsg.childNodes[0]);//remove wait message + var x = document.createTextNode('Refreshed database!'); + dbRefreshMsg.appendChild(x); + } + else{ + dbmsg.innerHTML = 'Refreshed database!'; + } + return; + } + } +} diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/DASMenu.jsp b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/DASMenu.jsp new file mode 100644 index 0000000000..041e05c8bb --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/DASMenu.jsp @@ -0,0 +1,63 @@ + + + + + + + + DASMenu: Web Sample + + + + + + +

Tuscany DAS Web Sample

+ +

Tuscany DAS web sample demonstrates - simple adhoc queries, DAS predefined commands execution and + some advanced features like Optimistic Concurrency Control (OCC), Converter, Result Set Shape etc. +

+

Check more details by navigating menu. + Press Refresh! button anytime for database refresh. +

+ +
+ + + + + + +
+ + \ No newline at end of file diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/converter.jsp b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/converter.jsp new file mode 100644 index 0000000000..a3610e7639 --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/converter.jsp @@ -0,0 +1,117 @@ + + +<%-- + * 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. + --%> + +<%-- JSTL tags --%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + + + + + + + + + + + +<%@ page import="java.util.*" %> + + + +
+ + + + + + + +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 "Pavick" and 1966.12.20 if + the value is "Williams" +
+ On write, the converter returns "Williams" if the property value is 1966.12.20 and "Pavick" + if the property value is 1957.09.27 +
+ Check using direct database connection that the database table rows's column values are + either "Williams" or "Pavick". +
+
+ +Select * from CUSTOMER where ID = 1; +
+ +Check First Customer's LastName is 1957.09.27 +
+ +Set First Customer's LastName to 1966.12.20 +
+ +Check First Customer's LastName is 1966.12.20 +
+ + +    + + +
+ + + +
 
+
+ + +
+ +
+ + + diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/default.css b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/default.css new file mode 100644 index 0000000000..5680fab9ed --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/default.css @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ + +BODY {BACKGROUND-COLOR: #FFFFFF; COLOR: #333366; FONT-FAMILY: 'Times New Roman'} +H1 {COLOR: #6666CC; FONT-FAMILY: 'Times New Roman'; TEXT-TRANSFORM: capitalize } +H2 {COLOR: #6666CC; FONT-FAMILY: 'Times New Roman'; TEXT-TRANSFORM: capitalize } +H3 {COLOR: #6666CC; FONT-FAMILY: 'Times New Roman'; TEXT-TRANSFORM: capitalize } +H4 {COLOR: #6666CC; FONT-FAMILY: 'Times New Roman'; TEXT-TRANSFORM: capitalize } +H5 {COLOR: #6666CC; FONT-FAMILY: 'Times New Roman'; TEXT-TRANSFORM: capitalize } +H6 {COLOR: #6666CC; FONT-FAMILY: 'Times New Roman'; TEXT-TRANSFORM: capitalize } +TH {COLOR: #000000; font-weight: bold } + +#TRowEven {background-color: #ccff99} +#TRowOdd {background-color: #ffffcc} + +A:link {cursor:hand; color: #3300FF; text-decoration: none;} +A:visited {cursor:hand; color: #3300FF; text-decoration: none; } +A:active {cursor:hand; color:#FEAA02; text-decoration: none;} +A:hover {cursor:hand; color:#FEAA02;} diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/indexAdhoc.jsp b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/indexAdhoc.jsp new file mode 100644 index 0000000000..f212d744f1 --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/indexAdhoc.jsp @@ -0,0 +1,87 @@ + + +<%-- + * 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. + --%> + +<%-- JSTL tags --%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + + + + + + + + + + + +<%@ page import="java.util.*" %> + + + +
+ + + + + + + +Adhoc SQL Query:
+ +    + + +
+ + + +
 
+
+ +
+ +
+ + + diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/indexCommand.jsp b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/indexCommand.jsp new file mode 100644 index 0000000000..55dcb56e38 --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/indexCommand.jsp @@ -0,0 +1,85 @@ + + +<%-- + * 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. + --%> + +<%-- JSTL tags --%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + + + + + + + + + + + +<%@ page import="java.util.*" %> + + + +
+ + + + + + + +DAS Command: + + + + + + +
+ + +
 
+
+ +
+ +
+ + + diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/main.css b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/main.css new file mode 100644 index 0000000000..264facc985 --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/main.css @@ -0,0 +1,120 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ + +body +{ + margin: 0px; + border: 0px; + padding: 0px; + font-family: Verdana, Arial, Sans-Serif; + font-size: 0px; +} + +img +{ + border: none 0px #ffffff; +} + +h1 +{ + background-color: #ffcc00; + border-bottom: solid 1px #333333; + padding: 5px; + margin: 0px; + font-size: x-large; +} + +h2 +{ + font-size: large; +} + +p +{ + font-size: small; +} + +/* Real menu */ +ul, li +{ + font-size: small; + margin-top: 0px; + margin-right: 0px; + margin-bottom: 0px; + display: block; +} + +ul +{ + width: 130px; + border: solid 1px #333333; + border-top: solid 5px #333333; + border-right: solid 2px #333333; + padding: 0px; +} + +li ul +{ + display: none; + position: absolute; + margin-left: 100px; + margin-top: -20px; +} + +li a +{ + padding: 2px; + text-decoration: none; + color: #000000; + background-color: #ffffee; + width: 100%; + display: block; + border-bottom: dashed 1px #333333; + text-indent: 2px; + font-size: small; +} + +li a:hover +{ + background-color: #ffcc00; + font-weight: bold; + border-bottom: solid 1px #333333; +} + +li +{ + float: left; + width: 98%; +} + +a.hassubmenu +{ + background-image: url(../img/lay_dmnuhassub.gif); + background-repeat: no-repeat; + background-position: 120px 7px; +} + +#mainmenu +{ + margin: 10px; + margin-left: 5px; + float: left; + border-bottom: solid 2px #333333; + margin-bottom: 100%; +} \ No newline at end of file diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/occ.jsp b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/occ.jsp new file mode 100644 index 0000000000..ed5a7ee0c1 --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/occ.jsp @@ -0,0 +1,77 @@ + + +<%-- + * 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. + --%> + +<%-- JSTL tags --%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + + + + + + + + + + + +<%@ page import="java.util.*" %> + + + +
+ + + + + + + +Automatic Optimistic Concurrency Control: + Try to modify same column in same database table row twice in one transaction. +
+ + +    + + +
+ + + +
 
+
+ +
+ +
+ + + diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/rss.jsp b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/rss.jsp new file mode 100644 index 0000000000..2d217d68b3 --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/jsp/rss.jsp @@ -0,0 +1,78 @@ + + +<%-- + * 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. + --%> + +<%-- JSTL tags --%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + + + + + + + + + + + +<%@ page import="java.util.*" %> + + + +
+ + + + + + + +Result Set Shape: + DAS has 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. +
+
+ +(Select 99, 'Roosevelt', '1600 Pennsylvania Avenue' from customer) + +    + + +
+ + + +
 
+
+ +
+ +
+ + + diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/company.xsl b/das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/company.xsl new file mode 100644 index 0000000000..99d9dc1fad --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/company.xsl @@ -0,0 +1,44 @@ + + + + + + + + +

Query Result

+ + + +
+ + + + + + + + + + +
COMPANYIDCOMPANYNAME
+ + + +
+
+
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/companyDepartment.xsl b/das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/companyDepartment.xsl new file mode 100644 index 0000000000..f79d30595e --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/companyDepartment.xsl @@ -0,0 +1,65 @@ + + + + + + + + + +

Query Result

+ + + +
+ + + + + + + + + + +
COMPANYIDCOMPANYNAME
+ + + +
+ + + + + + + + + + + + +
DEPIDDEPNAME
+ + + +
+ + + +
+
diff --git a/das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/customer.xsl b/das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/customer.xsl new file mode 100644 index 0000000000..40e260bcce --- /dev/null +++ b/das-java/trunk/samples/advanced-webapp/src/main/webapp/xsl/customer.xsl @@ -0,0 +1,49 @@ + + + + + + + + +

Query Result

+ + + + + + + + + + + + + + + +
IDLASTNAMEADDRESS
+ + + + + +
+ + +
+
diff --git a/das-java/trunk/samples/build.xml b/das-java/trunk/samples/build.xml new file mode 100644 index 0000000000..f78ca9a3c8 --- /dev/null +++ b/das-java/trunk/samples/build.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + diff --git a/das-java/trunk/samples/company-webapp/build.xml b/das-java/trunk/samples/company-webapp/build.xml new file mode 100644 index 0000000000..dd269b628e --- /dev/null +++ b/das-java/trunk/samples/company-webapp/build.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/das-java/trunk/samples/company-webapp/dastest/db.lck b/das-java/trunk/samples/company-webapp/dastest/db.lck new file mode 100644 index 0000000000..9f6b4b3d4b Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/db.lck differ diff --git a/das-java/trunk/samples/company-webapp/dastest/log/log.ctrl b/das-java/trunk/samples/company-webapp/dastest/log/log.ctrl new file mode 100644 index 0000000000..edbd775299 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/log/log.ctrl differ diff --git a/das-java/trunk/samples/company-webapp/dastest/log/log1.dat b/das-java/trunk/samples/company-webapp/dastest/log/log1.dat new file mode 100644 index 0000000000..7e85ac8e8f Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/log/log1.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/log/logmirror.ctrl b/das-java/trunk/samples/company-webapp/dastest/log/logmirror.ctrl new file mode 100644 index 0000000000..edbd775299 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/log/logmirror.ctrl differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c10.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c10.dat new file mode 100644 index 0000000000..5d8ecaa10f Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c10.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c101.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c101.dat new file mode 100644 index 0000000000..0f79fa7574 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c101.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c111.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c111.dat new file mode 100644 index 0000000000..39d49e3d19 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c111.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c121.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c121.dat new file mode 100644 index 0000000000..2a4311779b Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c121.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c130.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c130.dat new file mode 100644 index 0000000000..64e3c18d62 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c130.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c141.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c141.dat new file mode 100644 index 0000000000..0632d04164 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c141.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c150.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c150.dat new file mode 100644 index 0000000000..d7541026f6 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c150.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c161.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c161.dat new file mode 100644 index 0000000000..6673bf1873 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c161.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c171.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c171.dat new file mode 100644 index 0000000000..c2a753cc5d Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c171.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c180.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c180.dat new file mode 100644 index 0000000000..cb9391aed1 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c180.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c191.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c191.dat new file mode 100644 index 0000000000..d3cf1d6364 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c191.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c1a1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c1a1.dat new file mode 100644 index 0000000000..a7a2d536e9 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c1a1.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c1b1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c1b1.dat new file mode 100644 index 0000000000..19097e69e7 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c1b1.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c1c0.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c1c0.dat new file mode 100644 index 0000000000..359525a31a Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c1c0.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c1d1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c1d1.dat new file mode 100644 index 0000000000..9f257df932 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c1d1.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c1e0.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c1e0.dat new file mode 100644 index 0000000000..e43e52fb7f Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c1e0.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c1f1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c1f1.dat new file mode 100644 index 0000000000..7e6ee3b1e0 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c1f1.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c20.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c20.dat new file mode 100644 index 0000000000..1be6390f06 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c20.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c200.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c200.dat new file mode 100644 index 0000000000..b15d56855c Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c200.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c211.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c211.dat new file mode 100644 index 0000000000..84b0022312 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c211.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c221.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c221.dat new file mode 100644 index 0000000000..63106a9523 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c221.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c230.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c230.dat new file mode 100644 index 0000000000..9975f27c1f Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c230.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c241.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c241.dat new file mode 100644 index 0000000000..835c645a16 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c241.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c251.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c251.dat new file mode 100644 index 0000000000..d3d6adf4fb Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c251.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c260.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c260.dat new file mode 100644 index 0000000000..8d7333df7d Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c260.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c271.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c271.dat new file mode 100644 index 0000000000..af722f7d73 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c271.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c281.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c281.dat new file mode 100644 index 0000000000..3972983c2e Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c281.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c290.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c290.dat new file mode 100644 index 0000000000..31577b8124 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c290.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c2a1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c2a1.dat new file mode 100644 index 0000000000..0f700d13a7 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c2a1.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c2b1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c2b1.dat new file mode 100644 index 0000000000..1d6382fb3d Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c2b1.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c2c1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c2c1.dat new file mode 100644 index 0000000000..3bc60d886b Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c2c1.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c2d0.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c2d0.dat new file mode 100644 index 0000000000..c542d3c91c Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c2d0.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c2e1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c2e1.dat new file mode 100644 index 0000000000..16abd20b5f Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c2e1.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c2f0.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c2f0.dat new file mode 100644 index 0000000000..eb26be5932 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c2f0.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c300.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c300.dat new file mode 100644 index 0000000000..1214f1df4b Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c300.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c31.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c31.dat new file mode 100644 index 0000000000..18c16f1123 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c31.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c311.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c311.dat new file mode 100644 index 0000000000..926cbf25b5 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c311.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c320.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c320.dat new file mode 100644 index 0000000000..07e7bc023c Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c320.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c331.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c331.dat new file mode 100644 index 0000000000..fd827f9dc2 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c331.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c340.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c340.dat new file mode 100644 index 0000000000..ca70319886 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c340.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c351.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c351.dat new file mode 100644 index 0000000000..8fbe2a527c Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c351.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c360.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c360.dat new file mode 100644 index 0000000000..dcf9c746e1 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c360.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c371.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c371.dat new file mode 100644 index 0000000000..6f21a840ea Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c371.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c380.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c380.dat new file mode 100644 index 0000000000..b512e8065f Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c380.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c391.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c391.dat new file mode 100644 index 0000000000..27006e95a1 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c391.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c3a0.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c3a0.dat new file mode 100644 index 0000000000..565dca97ac Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c3a0.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c3b1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c3b1.dat new file mode 100644 index 0000000000..36894c9818 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c3b1.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c3c0.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c3c0.dat new file mode 100644 index 0000000000..d0c538aede Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c3c0.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c3d1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c3d1.dat new file mode 100644 index 0000000000..65bcec5527 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c3d1.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c3e0.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c3e0.dat new file mode 100644 index 0000000000..bdab359420 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c3e0.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c3f1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c3f1.dat new file mode 100644 index 0000000000..dc2d278b57 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c3f1.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c400.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c400.dat new file mode 100644 index 0000000000..3072709cec Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c400.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c41.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c41.dat new file mode 100644 index 0000000000..61086690f2 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c41.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c411.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c411.dat new file mode 100644 index 0000000000..ca551d8249 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c411.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c420.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c420.dat new file mode 100644 index 0000000000..f04de0840e Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c420.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c431.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c431.dat new file mode 100644 index 0000000000..398b1672cc Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c431.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c440.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c440.dat new file mode 100644 index 0000000000..af259d0872 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c440.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c451.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c451.dat new file mode 100644 index 0000000000..772a18c658 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c451.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c460.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c460.dat new file mode 100644 index 0000000000..505428362d Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c460.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c471.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c471.dat new file mode 100644 index 0000000000..484d0df42d Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c471.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c481.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c481.dat new file mode 100644 index 0000000000..faac073076 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c481.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c490.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c490.dat new file mode 100644 index 0000000000..7585319d21 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c490.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c4a1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c4a1.dat new file mode 100644 index 0000000000..4fe8b786e3 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c4a1.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c51.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c51.dat new file mode 100644 index 0000000000..7fc7937b15 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c51.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c60.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c60.dat new file mode 100644 index 0000000000..d1fb08c946 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c60.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c71.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c71.dat new file mode 100644 index 0000000000..d4c2090a3b Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c71.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c81.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c81.dat new file mode 100644 index 0000000000..38b6ea6520 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c81.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/c90.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/c90.dat new file mode 100644 index 0000000000..a607a5969c Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/c90.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/ca1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/ca1.dat new file mode 100644 index 0000000000..19b4c9e340 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/ca1.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/cb1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/cb1.dat new file mode 100644 index 0000000000..73dc986572 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/cb1.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/cc0.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/cc0.dat new file mode 100644 index 0000000000..d1eef3bb56 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/cc0.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/cd1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/cd1.dat new file mode 100644 index 0000000000..c7e6db3ef7 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/cd1.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/ce1.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/ce1.dat new file mode 100644 index 0000000000..8fd3bf17a8 Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/ce1.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/seg0/cf0.dat b/das-java/trunk/samples/company-webapp/dastest/seg0/cf0.dat new file mode 100644 index 0000000000..332b3d9a8a Binary files /dev/null and b/das-java/trunk/samples/company-webapp/dastest/seg0/cf0.dat differ diff --git a/das-java/trunk/samples/company-webapp/dastest/service.properties b/das-java/trunk/samples/company-webapp/dastest/service.properties new file mode 100644 index 0000000000..8cfe3b09a5 --- /dev/null +++ b/das-java/trunk/samples/company-webapp/dastest/service.properties @@ -0,0 +1,22 @@ +#C:\apacheSVN\java\target\dastest +# ******************************************************************** +# *** Please do NOT edit this file. *** +# *** CHANGING THE CONTENT OF THIS FILE MAY CAUSE DATA CORRUPTION. *** +# ******************************************************************** +#Fri Feb 17 08:55:29 MST 2006 +SysschemasIndex2Identifier=225 +SyscolumnsIdentifier=144 +SysconglomeratesIndex1Identifier=49 +SysconglomeratesIdentifier=32 +SyscolumnsIndex2Identifier=177 +SysschemasIndex1Identifier=209 +SysconglomeratesIndex3Identifier=81 +SystablesIndex2Identifier=129 +SyscolumnsIndex1Identifier=161 +derby.serviceProtocol=org.apache.derby.database.Database +SysschemasIdentifier=192 +derby.storage.propertiesId=16 +SysconglomeratesIndex2Identifier=65 +derby.serviceLocale=en_US +SystablesIdentifier=96 +SystablesIndex1Identifier=113 diff --git a/das-java/trunk/samples/company-webapp/pom.xml b/das-java/trunk/samples/company-webapp/pom.xml new file mode 100644 index 0000000000..5cab332043 --- /dev/null +++ b/das-java/trunk/samples/company-webapp/pom.xml @@ -0,0 +1,89 @@ + + + + 4.0.0 + + org.apache.tuscany.das.samples + tuscany-das-samples + 1.0-SNAPSHOT + + + tuscany-das-sample-company-webapp + war + Tuscany DAS Company Sample + Sample use of RDB DAS in a Web application + + + + org.apache.tuscany.das + tuscany-das-rdb + ${das.version} + compile + + + + org.apache.tuscany.sdo + tuscany-sdo-impl + ${sdo.version} + compile + + + + org.apache.tuscany.sdo + tuscany-sdo-api-r2.1 + ${sdo.version} + compile + + + + org.apache.tuscany.das.samples + tuscany-das-sample-dbconfig + ${das.version} + compile + + + org.apache.derby + derby + + + + + + javax.servlet + servlet-api + 2.5 + provided + + + + + + sample-company-webapp + src/main/java + + + src/main/java + + + src/main/resources + + + + diff --git a/das-java/trunk/samples/company-webapp/readme.htm b/das-java/trunk/samples/company-webapp/readme.htm new file mode 100644 index 0000000000..f632162b2a --- /dev/null +++ b/das-java/trunk/samples/company-webapp/readme.htm @@ -0,0 +1,201 @@ + + + + + +Tuscany DAS Sample - Company webapp + + + + + + + +

DAS Company web application Sample

+ +
+
+ +

+This stand-alone sample demonstrates the SDO RDB Data Access Service in the context of a simple web application
+

+

+The application starts with a database of Companies and their related Departments.Through the web page interface, a user can:
+
+ +

    +
  1. Display all Companies in the database
  2. +
  3. Display all Companies and related Departments
  4. +
  5. Add a new Department to a Company
  6. +
  7. Delete all Departments from a Company
  8. +
  9. Change the names of Departments in a Company
  10. +
+ +

This simple application covers all CRUD operations as well as some relationship manipulation (adding a Department associates that +Department with the Company).The sample runs on Tomcat 6.0 and employs a Derby database (default) accessed via a DataSource.

+ +

Running the sample

+ +

There are two options for running this sample:

+ +
    +
  1. Run from Tomcat configured by the build
  2. +
  3. Deploying the Company-webapp WAR into a Tomcat you configure yourself
  4. +
+ +

Running from Tomcat configured by the build

+ +

+You need to download the Tuscany RDB DAS source distribution and run maven build to use this option. +When you build using maven from the source root {SRC_ROOT} directory, the sample war file is created +under {SRC_ROOT}/samples/company-webapp/target. This sample application is deployed to an instance +of Tomcat as part of our automated sample testing. For this, follow readme.htm instructions from +{SRC_ROOT}/samples/testing/tomcat. This will in-effect run the htmlunit tests on the sample. +The sample deployed on Tomcat instance will be ready this way and you can just point your browser +to http://localhost:8080/sample-company-webapp/ +to test further. +

+ +

Deploying the Company-webapp WAR into a Tomcat you configured yourself

+ +

+Alternatively, you can deploy the sample to your own configured Tomcat installation by following +the instructions below.These instructions assume that you have either 1) downloaded the Tuscany +binary distribution or 2) Downloaded the Tuscany source and run maven build.See the following +link for more details steps on how to build DAS Sample applications +http://incubator.apache.org/tuscany/das-java-developer-guide.html. +

+ +Set Up - Derby + +
    +
  • Download and install the most recent stable version of Tomcat 5.5 or Tomcat 6. You can find it here: http://tomcat.apache.org/download-60.cgi
  • +
  • Download the most recent official release of Derby from here: http://db.apache.org/derby/index.html. The only file you'll need from this download is derby(version).jar
  • +
  • Stop Tomcat
  • +
  • Copy derby(version).jar (from the derby distribution) to {Tomcat_Home}/common/lib (for Tomcat 5.5) or to {Tomcat_Home}/lib (for Tomcat 6) - e.g. derby-10.2.2.0.jar.
  • +
  • Add the sample war file to {Tomcat_Home}/webapps +
      +
    • sample-company-webapp.war
    • +
    +
  • +
  • Define a DataSource by adding a datasource definition to {Tomcat_Home}/conf/server.xml. +
      +
    • Find the end-of-section marker and add the following lines just above it:
    • +
    + +
    +        <!-- Global Datasource for Derby dastest database -->
    +        <Resource name="jdbc/dastest"
    +                  type="javax.sql.DataSource" auth="Container"
    +                  description="Derby database for DAS Company sample"
    +                  maxActive="100" maxIdle="30" maxWait="10000"
    +                  username="" password=""
    +                  driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
    +                  url="jdbc:derby:{absolute path}Databases/dastest;create=true"/>
    +        
    + + Requirement: You must include the absolute path to the Databases directory in the above url attribute.
    + Fore example: <url="jdbc:derby:c:\apache-tomcat-6.0.13\Databases/ajaxdastest;create=true"/> +

    + As the new utility, dbConfig is embedded in this sample war, the Derby database "dastest" will get + created with required tables and data when the web application gets loaded for the first time in tomcat. +

    +
  • +
  • Start tomcat and point your browser to: http://localhost:8080/sample-company-webapp/
  • +
+ + +Set Up - MySQL + +
    +
  • Download and install the most recent stable version of Tomcat 5.5 or Tomcat 6. You can find it here: http://tomcat.apache.org/download-60.cgi
  • +
  • Download the most recent official release of MySQL driver, e.g. mysql-connector-java-5.0.4.jar
  • +
  • Stop Tomcat
  • +
  • Copy mysql(version).jar (from the MySQL distribution) to {Tomcat_Home}/common/lib (for Tomcat 5.5) or to {Tomcat_Home}/lib (for Tomcat 6) - e.g. mysql-connector-java-5.0.4.jar.
  • +
  • Add the sample war file to {Tomcat_Home}/webapps +
      +
    • sample-company-webapp.war
    • +
    +
  • +
  • Define a DataSource by adding a datasource definition to {Tomcat_Home}/conf/server.xml. +
      +
    • Find the end-of-section marker and add the following lines just above it:
    • +
    + +
    +        <!-- Global Datasource for MySQL dastest database -->
    +        <Resource name="jdbc/dastest"
    +                  type="javax.sql.DataSource" auth="Container"
    +                  description="MySQL database for DAS Company sample"
    +                  maxActive="100" maxIdle="30" maxWait="10000"
    +                  username="dastest" password="dastest"
    +                  driverClassName="com.mysql.jdbc.Driver"
    +                  url="jdbc:mysql://localhost/dastest?createDatabaseIfNotExist=true"/>
    +        
    + + Requirement:MySQL service should be up with configured port open for TCPIP communication.
    +

    + As the new utility, dbConfig is embedded in this sample war, the MySQL database "dastest" will get created with + required tables and data when the web application gets loaded for the first time in tomcat. Please note that, + in the binary distribution, WEB-INF/classes/CompanyWebDBConfig.xml has SQL Table creation syntax for Derby. + To make it compatible to MySQL, simply replace GENERATED ALWAYS AS IDENTITY with AUTO_INCREMENT for all + table creation statements. (For this unjar the .war, change CompanyWebDBConfig.xml and jar the .war + back with changed CompanyWebDBConfig.xml) +
    +
    +
  • +
  • Start tomcat and point your browser to: http://localhost:8080/sample-advanced-webapp/
  • +
+ + +

Sample Architecture

+ +

+This is a simple, single-page, web application.The main components of this application are: +

+ +
    +
  • The RDB Data Access Service (DAS)
  • +
  • SDO
  • +
  • CompanyClient.java
  • +
  • Company.jsp
  • +
+ +

The CompanyClient uses the DAS directly and provides high-level services to the jsp such as:

+

public final List getCompanies()

+ +

This is a good place to look for how you might use the DAS in your own application.

+ +

The Company.jsp responds to client interaction by invoking services of the CompanyClient.It receives data +from the CompanyClient as SDO data graphs and manipulates SDOs directly to display data.

+ +

The DAS accepts directives (commands) from the CompanyClient and reads and writes to the derby +database instance appropriately.

+ + + + diff --git a/das-java/trunk/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyClient.java b/das-java/trunk/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyClient.java new file mode 100644 index 0000000000..d0519ecc08 --- /dev/null +++ b/das-java/trunk/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyClient.java @@ -0,0 +1,151 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.samples.das.companyweb; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Random; + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.DAS; + +import commonj.sdo.DataObject; + +public class CompanyClient { + + private Random generator = new Random(); + + private DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml")); + + public final List getCompanies() { + + Command read = das.getCommand("all companies"); + DataObject root = read.executeQuery(); + return root.getList("COMPANY"); + + } + + public final List getCompaniesWithDepartments() { + + Command read = das.getCommand("all companies and departments"); + DataObject root = read.executeQuery(); + return root.getList("COMPANY"); + } + + public final List getDepartmentsForCompany(int id) { + Command read = das.getCommand("all departments for company"); + read.setParameter(1, new Integer(id)); + DataObject root = read.executeQuery(); + return root.getList("COMPANY"); + } + + public final void addDepartmentToFirstCompany() { + Command read = das.getCommand("all companies and departments"); + DataObject root = read.executeQuery(); + DataObject firstCustomer = root.getDataObject("COMPANY[1]"); + + DataObject newDepartment = root.createDataObject("DEPARTMENT"); + newDepartment.setString("NAME", "Default Name"); + firstCustomer.getList("departments").add(newDepartment); + + das.applyChanges(root); + + } + + public final void deleteDepartmentsFromFirstCompany() { + + // This section gets the ID of the first Company just so I can + // demonstrate a parameterized command next + Command readAll = das.getCommand("all companies and departments"); + DataObject root = readAll.executeQuery(); + int idOfFirstCustomer = root.getInt("COMPANY[1]/ID"); + System.out.println("ID of first company is: " + idOfFirstCustomer); + + // Read a specific company based on the known ID + Command readCust = das.getCommand("company by id with departments"); + readCust.setParameter(1, new Integer(idOfFirstCustomer)); + root = readCust.executeQuery(); + + // Delete all the comany's departments from the graph + DataObject firstCustomer = root.getDataObject("COMPANY[1]"); + + // Shallow copy of list for deleting. This is required to avoid the + // dreaded + // ConcurrentModificationException since #delete operation also removes + // from the original list + List allDepartments = new ArrayList(firstCustomer.getList("departments")); + + Iterator i = allDepartments.iterator(); + DataObject department; + while (i.hasNext()) { + department = (DataObject) i.next(); + System.out.println("Deleting department named: " + department.getString("NAME")); + department.delete(); + } + + das.applyChanges(root); + + } + + public final void changeFirstCompanysDepartmentNames() { + + // This section gets the ID of the first Company just so I can + // demonstrate a parameterized command next + Command readAll = das.getCommand("all companies and departments"); + DataObject root = readAll.executeQuery(); + int idOfFirstCustomer = root.getInt("COMPANY[1]/ID"); + System.out.println("ID of first company is: " + idOfFirstCustomer); + + // Read a specific company based on the known ID + Command readCust = das.getCommand("company by id with departments"); + readCust.setParameter(1, new Integer(idOfFirstCustomer)); + root = readCust.executeQuery(); + + // Modify all the comany's department names + DataObject firstCustomer = root.getDataObject("COMPANY[1]"); + Iterator i = firstCustomer.getList("departments").iterator(); + DataObject department; + while (i.hasNext()) { + department = (DataObject) i.next(); + System.out.println("Modifying department: " + department.getString("NAME")); + department.setString("NAME", getRandomDepartmentName()); + } + das.applyChanges(root); + + } + + + public void releaseResources() { + das.releaseResources(); + } + + // Utilities + + private String getRandomDepartmentName() { + int number = generator.nextInt(1000) + 1; + return "Dept-" + number; + } + + private InputStream getConfig(String fileName) { + return getClass().getClassLoader().getResourceAsStream(fileName); + } + +} diff --git a/das-java/trunk/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyDBInit.java b/das-java/trunk/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyDBInit.java new file mode 100644 index 0000000000..edd62e6f30 --- /dev/null +++ b/das-java/trunk/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyDBInit.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.samples.das.companyweb; + +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintWriter; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.tuscany.das.rdb.dbconfig.DBInitializer; + +public class CompanyDBInit extends HttpServlet { + private static final long serialVersionUID = -4795999792460944805L; + private static final String dbConfigFile = "CompanyWebDBConfig.xml"; + + public void init() throws ServletException { + try { + DBInitializer dbInitializer; + dbInitializer = new DBInitializer(getConfig(dbConfigFile)); + if (! dbInitializer.isDatabaseReady()) { + dbInitializer.initializeDatabase(true); + } + } catch (Exception e) { + + e.printStackTrace(); + log(e.toString(), e); + throw new ServletException(e); + } + } + + /* + * (non-Java-doc) + * + * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest arg0, HttpServletResponse arg1) + */ + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + response.setContentType("text/html"); + + PrintWriter out = response.getWriter(); + + out.println(); + out.println("

CompanyWeb database initialization servlet !

"); + out.println(); + } + + private InputStream getConfig(String fileName) { + return getClass().getClassLoader().getResourceAsStream(fileName); + } + +} diff --git a/das-java/trunk/samples/company-webapp/src/main/resources/CompanyConfig.xml b/das-java/trunk/samples/company-webapp/src/main/resources/CompanyConfig.xml new file mode 100644 index 0000000000..a674724323 --- /dev/null +++ b/das-java/trunk/samples/company-webapp/src/main/resources/CompanyConfig.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + +
diff --git a/das-java/trunk/samples/company-webapp/src/main/resources/CompanyWebDBConfig.xml b/das-java/trunk/samples/company-webapp/src/main/resources/CompanyWebDBConfig.xml new file mode 100644 index 0000000000..c064045fd5 --- /dev/null +++ b/das-java/trunk/samples/company-webapp/src/main/resources/CompanyWebDBConfig.xml @@ -0,0 +1,51 @@ + + + + + + + + + 'ACME Publishing' + 'Do-rite plumbing' + 'MegaCorp' +
+ + 'Advanced Technologies', 'NY', '123', 1 + 'Default Name 2', '', '', 1 + 'Default Name 3', '', '', 1 + 'Default Name 4', '', '', 1 + 'Default Name 5', '', '', 1 + 'Default Name 6', '', '', 1 + 'Default Name 7', '', '', 1 + 'Default Name 8', '', '', 1 +
+ + 'John Jones','E0001',0,1 + 'Mary Smith','E0002',1,null + 'Jane Doe','E0003',0,1 + 'Al Smith','E0004',1,1 +
+
diff --git a/das-java/trunk/samples/company-webapp/src/main/resources/META-INF/LICENSE b/das-java/trunk/samples/company-webapp/src/main/resources/META-INF/LICENSE new file mode 100644 index 0000000000..9597d92eb3 --- /dev/null +++ b/das-java/trunk/samples/company-webapp/src/main/resources/META-INF/LICENSE @@ -0,0 +1,353 @@ + + 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. + +=============================================================================================================== + +Other components and dependencies under Apache Software License 2.0 : + + log4j-1.2.14.jar - Apache Logging Services + derby 10.2.2.0.jar - Apache Derby + stax-api-1.0.1.jar - The Streaming API for XML (StAX) + wstx-asl-3.2.0.jar - WoodStox StAX implementation + standard-1.1.1.jar - The Apache Jackarta Taglibs + jstl-1.1.2.jar - The Apache Jackarta Taglibs + *.tld - The Apache Jackarta Taglibs + +=============================================================================================================== + + +Apache Tuscany SDO for Java Subcomponents +=========================================: + +The Tuscany SDO for Java release 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. + +License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar) + +Permission to copy, make derivative works of, and distribute the Service Data Objects +JavaDoc and Interface Definition Files files in any medium without fee or royalty as part +of a compliant implementation of the Service Data Objects Specification is hereby granted. +The Service Data Objects Specification may be found at any of the following locations: + +http://dev2dev.bea.com/technologies/commonj/index.jsp +http://www.ibm.com/developerworks/library/specification/ws-sdo/ +http://oracle.com/technology/webservices/sca +https://www.sdn.sap.com/ +http://www.xcalia/xdn/specs/sdo + +THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES +ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS +SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS, +INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE +SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES. + +The name and trademarks of the Authors may NOT be used in any manner, including advertising or +publicity pertaining to the Service Component Architecture Specification or its contents without specific, +written prior permission. Title to copyright in the Service Data Objects Specification and the +JavaDoc and Interface Definition Files will at all times remain with the Authors. + +No other rights are granted by implication, estoppel or otherwise. + +================================================================================================================= + +For the Eclipse EMF components +(codegen-2.2.3.jar +codegen-ecore-2.2.3.jar +common-2.2.3.jar +ecore-2.2.3.jar +ecore-change-2.2.3.jar +ecore-xmi-2.2.3.jar +xsd-2.2.3.jar) + +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. + +=================================================================================================== diff --git a/das-java/trunk/samples/company-webapp/src/main/resources/META-INF/NOTICE b/das-java/trunk/samples/company-webapp/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..e9d98fc7f5 --- /dev/null +++ b/das-java/trunk/samples/company-webapp/src/main/resources/META-INF/NOTICE @@ -0,0 +1,32 @@ +Apache Tuscany SDO for Java +Copyright 2006, 2007 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF), +sponsored by the Apache 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. + +Unless otherwise indicated, all distribution made available by the Apache Software Foundation +is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL"). +A copy of the AL is provided with this distribution as the LICENSE.txt file present in the +root directory, and is also available at http://www.apache.org/licenses/. + +The terms and conditions governing the distribution may refer to the AL or other license +agreements, notices or terms and conditions. Some of these other license agreements may +include (but are not limited to): + + . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html) + +It is your obligation to read and accept all such terms and conditions prior to use of the +distribution. If term or condition is provided, please contact the Apache Software Foundation +to determine what terms and conditions govern that particular distribution. + +This product also includes software developed by the Open Service Oriented Architecture organisation +(http://osoa.org). The license for this software may be found in the LICENSE.txt file contained in this +distribution. diff --git a/das-java/trunk/samples/company-webapp/src/main/resources/META-INF/README b/das-java/trunk/samples/company-webapp/src/main/resources/META-INF/README new file mode 100644 index 0000000000..107de8c3ca --- /dev/null +++ b/das-java/trunk/samples/company-webapp/src/main/resources/META-INF/README @@ -0,0 +1,35 @@ +Apache Tuscany M2 build (October, 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/das-java/trunk/samples/company-webapp/src/main/resources/log4j.properties b/das-java/trunk/samples/company-webapp/src/main/resources/log4j.properties new file mode 100644 index 0000000000..ab4ebbb785 --- /dev/null +++ b/das-java/trunk/samples/company-webapp/src/main/resources/log4j.properties @@ -0,0 +1,36 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# +# Set root logger level to DEBUG and its only appender to A1. +log4j.rootLogger=INFO, NULL + +# NULL Appender +log4j.appender.NULL=org.apache.log4j.varia.NullAppender + +log4j.appender.NULL.layout=org.apache.log4j.PatternLayout +log4j.appender.NULL.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n + +# CONSOLE is set to be a ConsoleAppender. +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n + + +# Print only messages of level WARN or above in the package com.foo. +log4j.logger.org.apache.tuscany=NONE \ No newline at end of file diff --git a/das-java/trunk/samples/company-webapp/src/main/webapp/Company.jsp b/das-java/trunk/samples/company-webapp/src/main/webapp/Company.jsp new file mode 100644 index 0000000000..9b74f0a357 --- /dev/null +++ b/das-java/trunk/samples/company-webapp/src/main/webapp/Company.jsp @@ -0,0 +1,155 @@ + + + + +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" + import="commonj.sdo.*" + + import="org.apache.tuscany.samples.das.companyweb.CompanyClient" +%> + +Company Test + + + +

Tuscany DAS Companies WEB Example

+ + +
+ + + + + +
+ + +<%if(request.getParameter("doFill") != null){%> + + + + + + + + + + + <% + CompanyClient companyClient = new CompanyClient(); + java.util.Iterator i = companyClient.getCompaniesWithDepartments().iterator(); + while (i.hasNext()) { + DataObject company = (DataObject)i.next(); + %> + + + + + <% + } + companyClient.releaseResources(); + %> + + +
IDName
<%=company.getInt("ID")%><%=company.getString("NAME")%>
+<%}%> + + + +<% +if(request.getParameter("doAddDepartment") != null){ + CompanyClient companyClient = new CompanyClient(); + companyClient.addDepartmentToFirstCompany(); + companyClient.releaseResources(); +} +%> + + +<% +if(request.getParameter("doDeleteDepartments") != null){ + CompanyClient companyClient = new CompanyClient(); + companyClient.deleteDepartmentsFromFirstCompany(); + companyClient.releaseResources(); +} +%> + + +<% +if(request.getParameter("doChangeDepartmentNames") != null){ + CompanyClient companyClient = new CompanyClient(); + companyClient.changeFirstCompanysDepartmentNames(); + companyClient.releaseResources(); +} +%> + + + +<%if(request.getParameter("doFill") == null) {%> + + + + + + + + + + + + + <% + CompanyClient companyClient = new CompanyClient(); + java.util.Iterator i = companyClient.getCompaniesWithDepartments().iterator(); + while (i.hasNext()) { + DataObject company = (DataObject)i.next(); + %> + + + + + + + + <% + java.util.Iterator j = company.getList("departments").iterator(); + while (j.hasNext()) { + DataObject department = (DataObject)j.next(); + %> + + + + + <% + } + %> + <% + } + companyClient.releaseResources(); + %> + + +
IDNameDepartment_IDDepartment_Name
<%=company.getInt("ID")%><%=company.getString("NAME")%>
<%=department.getInt("ID")%><%=department.getString("NAME")%>
+<%}%> + + + +
+ + diff --git a/das-java/trunk/samples/company-webapp/src/main/webapp/META-INF/context.xml b/das-java/trunk/samples/company-webapp/src/main/webapp/META-INF/context.xml new file mode 100644 index 0000000000..5f0af32dd5 --- /dev/null +++ b/das-java/trunk/samples/company-webapp/src/main/webapp/META-INF/context.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/das-java/trunk/samples/company-webapp/src/main/webapp/WEB-INF/web.xml b/das-java/trunk/samples/company-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..a0abb6a655 --- /dev/null +++ b/das-java/trunk/samples/company-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,36 @@ + + + + + + Tuscany DAS sample Company WEB + + + Company.jsp + + + + + CompanyDBInit + org.apache.tuscany.samples.das.companyweb.CompanyDBInit + 2 + + diff --git a/das-java/trunk/samples/customer/build.xml b/das-java/trunk/samples/customer/build.xml new file mode 100644 index 0000000000..94ce30e1ca --- /dev/null +++ b/das-java/trunk/samples/customer/build.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/das-java/trunk/samples/customer/pom.xml b/das-java/trunk/samples/customer/pom.xml new file mode 100644 index 0000000000..f8665da523 --- /dev/null +++ b/das-java/trunk/samples/customer/pom.xml @@ -0,0 +1,92 @@ + + + + 4.0.0 + + org.apache.tuscany.das.samples + tuscany-das-samples + 1.0-SNAPSHOT + + + tuscany-das-sample-customer + jar + Tuscany DAS Customer Sample + Sample use of RDB DAS in a J2SE application + + + + org.apache.tuscany.das + tuscany-das-rdb + ${das.version} + compile + + + + org.apache.tuscany.sdo + tuscany-sdo-impl + ${sdo.version} + compile + + + + org.apache.tuscany.sdo + tuscany-sdo-api-r2.1 + ${sdo.version} + compile + + + + org.apache.derby + derby + 10.2.2.0 + compile + + + + + + sample-customer + src/main/java + + + src/main/java + + + src/main/resources + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + org.apache.tuscany.samples.das.customer.CustomerClient + true + + + + + + + + + diff --git a/das-java/trunk/samples/customer/readme.htm b/das-java/trunk/samples/customer/readme.htm new file mode 100644 index 0000000000..0c1f6f715d --- /dev/null +++ b/das-java/trunk/samples/customer/readme.htm @@ -0,0 +1,156 @@ + + + + + + +Tuscany DAS Sample - Customer + + + + + +

Customer J2SE sample application

+ +
+ +

+This stand-alone sample demonstrates the RDB Data Access Service in the context of a simple java application. +

+ +
+ +

Building and Running

+ +
    +
  • Apache Ant latest version installed. +
      +
    • Download Apache Ant latest version on and extract into folder <apache_ant_folder>. You can find it here: http://ant.apache.org/bindownload.cgi.
    • +
    • Add <apache_ant_folder>/bin directory to your OS path variable.

    • +
    +
  • + +
  • On console change the actual directory to <tuscany_das_java_distribution>/samples/customer/ and execute ant application: +
      +
    • <tuscany_das_java_distribution>/samples/customer/> ant
    • +
    +
  • +
+ +

+The sample will run and output the following: +

+ +

+

+Buildfile: build.xml
+
+run:
+     [java] ************* Initializing database *************
+     [java] ** DB type  : derby
+     [java] ** Database : jdbc:derby:target/dastest; create = true
+     [java] ** User     :
+     [java] ** Password :
+     [java] ************************************************
+     [java] Setting up for derby run!
+     [java] Dropping tables
+     [java] Dropping procedures
+     [java] Creating tables
+     [java] Creating procedures
+     [java] Inserting data in tables
+     [java] Database setup complete!
+     [java]
+     [java] Result:select all customers
+     [java]    ID:1 LASTNAME:John ADDRESS:USA
+     [java]    ID:2 LASTNAME:Amita ADDRESS:INDIA
+     [java]    ID:3 LASTNAME:Patrick ADDRESS:UK
+     [java]    ID:4 LASTNAME:Jane ADDRESS:UN
+     [java]
+     [java] Result:insert new customer
+     [java]    ID:1 LASTNAME:John ADDRESS:USA
+     [java]    ID:2 LASTNAME:Amita ADDRESS:INDIA
+     [java]    ID:3 LASTNAME:Patrick ADDRESS:UK
+     [java]    ID:4 LASTNAME:Jane ADDRESS:UN
+     [java]    ID:5 LASTNAME:Jenny ADDRESS:USA
+     [java]
+     [java] Result:update first customer
+     [java]    ID:1 LASTNAME:BlueBerry ADDRESS:USA
+     [java]    ID:2 LASTNAME:Amita ADDRESS:INDIA
+     [java]    ID:3 LASTNAME:Patrick ADDRESS:UK
+     [java]    ID:4 LASTNAME:Jane ADDRESS:UN
+     [java]    ID:5 LASTNAME:Jenny ADDRESS:USA
+     [java]
+     [java] Result:delete last customer
+     [java] Deleting customer named: Jenny
+     [java]    ID:1 LASTNAME:BlueBerry ADDRESS:USA
+     [java]    ID:2 LASTNAME:Amita ADDRESS:INDIA
+     [java]    ID:3 LASTNAME:Patrick ADDRESS:UK
+     [java]    ID:4 LASTNAME:Jane ADDRESS:UN
+
+BUILD SUCCESSFUL
+
+

+ +
+ +

+Observation:The build.xml ant file only works on DAS Java binary distribution. +

+ + + +

Running Sample with MySQL

+
+

+The sample is pre-configured to run using an embedded Derby database.Follow below instructions to run the sample on another database (e.g MySQL).
+

+ +
    +
  • Expand sample-customer.jar under /samples/customer to access CustomersConfig.xml
  • +
  • Change CustomersConfig.xml - comment Derby connection info and uncomment MySQL connection info. Check for correct userName, password, and other configuration information
  • +
  • Change /samples/customer /build.xml to replace pathelement location from Derby jar to MySQL jar like - +
      +
    • <pathelement location="mysql-connector-java-5.0.4.jar"/>
    • +
    +
  • +
  • Create new sample-customer.jar to use the changed CustomersConfig.xml , replacing the one from binary distribution under /samples/customer.
  • +
  • Place required mysql jar (e.g. mysql-connector-java-5.0.4.jar) under /samples/customer.
  • +
  • From command prompt run the sample application using ant - +
      +
    • <tuscany_das_java_distribution>/samples/customer/> ant
    • +
    +
  • +
+ +

+Observations: +

    +
  • These instructions apply only for DAS Java binary distribution.
  • +
  • MySQL Database will be created and populated with necessary structure and data if not present
  • +
+ + + \ No newline at end of file diff --git a/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerClient.java b/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerClient.java new file mode 100644 index 0000000000..ca66c5bf4f --- /dev/null +++ b/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerClient.java @@ -0,0 +1,197 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.samples.das.customer; + +import java.io.InputStream; +import java.util.List; + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.DAS; + +import commonj.sdo.DataObject; + +public class CustomerClient { + private static final String DEFAULT_CUSTOMER_CONFIG = "CustomersConfig.xml"; + + private DAS das = null; + private final String configFile; + + /** + * Default constructor + * + */ + public CustomerClient(){ + this.configFile = DEFAULT_CUSTOMER_CONFIG; + } + + /** + * Constructor receiving the das config file to be used + * @param configFile DAS configuration file + */ + public CustomerClient(String configFile) { + this.configFile = configFile; + } + + /** + * Helper method to get a stream from the customer config file + * @param fileName + * @return + */ + protected InputStream getConfig(String fileName) { + return getClass().getClassLoader().getResourceAsStream(fileName); + } + + /** + * Get a reference to DAS, initialize it if necessary + * @return DAS reference + */ + protected DAS getDAS() { + if (this.das == null ) { + this.das = DAS.FACTORY.createDAS(getConfig(this.configFile)); + } + return this.das; + } + + + /** + * select + * @return + */ + public final List getCustomers() { + Command read = this.getDAS().getCommand("AllCustomers"); + DataObject root = read.executeQuery(); + return root.getList("CUSTOMER"); + } + + /** + * insert + * + */ + public final void addCustomer() { + Command read = this.getDAS().getCommand("AllCustomers"); + DataObject root = read.executeQuery(); + + DataObject newCustomer = root.createDataObject("CUSTOMER"); + newCustomer.setInt("ID", 5); + newCustomer.setString("LASTNAME", "Jenny"); + newCustomer.setString("ADDRESS", "USA"); + + das.applyChanges(root); + } + + /** + * delete + * + */ + public final void deleteCustomer() { + Command readAll = this.getDAS().getCommand("AllCustomers"); + DataObject root = readAll.executeQuery(); + + List allCustomers = root.getList("CUSTOMER"); + + DataObject lastCustomer = (DataObject)allCustomers.get(allCustomers.size()-1); + if(lastCustomer != null){ + System.out.println("Deleting customer named: " + lastCustomer.getString("LASTNAME")); + lastCustomer.delete(); + } + + das.applyChanges(root); + } + + /** + * update + * + */ + public final void changeFirstCustomerName() { + Command readAll = this.getDAS().getCommand("AllCustomers"); + DataObject root = readAll.executeQuery(); + + DataObject firstCustomer = root.getDataObject("CUSTOMER[1]"); + firstCustomer.set("LASTNAME", "BlueBerry"); + + das.applyChanges(root); + } + + /** + * display result + * @param customers + */ + public static void printList(List customers){ + for(int i=0; i0){ + customerConfigFile = args[0]; + } + + + //initialize customer database using helper class + CustomerDatabaseInitializer dbInitializer = new CustomerDatabaseInitializer(customerConfigFile); + try { + dbInitializer.Initialize(); + } catch (Exception e) { + e.printStackTrace(); + return; + } + + + //perform customer operations using DAS + CustomerClient customerClient = new CustomerClient(customerConfigFile); + //test select + System.out.println(); + System.out.println("Result:select all customers"); + printList(customerClient.getCustomers()); + + //test insert + System.out.println(); + System.out.println("Result:insert new customer"); + customerClient.addCustomer(); + printList(customerClient.getCustomers()); + + //test update + System.out.println(); + System.out.println("Result:update first customer"); + customerClient.changeFirstCustomerName(); + printList(customerClient.getCustomers()); + + //test delete + System.out.println(); + System.out.println("Result:delete last customer"); + customerClient.deleteCustomer(); + printList(customerClient.getCustomers()); + } +} \ No newline at end of file diff --git a/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerDatabaseInitializer.java b/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerDatabaseInitializer.java new file mode 100644 index 0000000000..260fc330fd --- /dev/null +++ b/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerDatabaseInitializer.java @@ -0,0 +1,92 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.samples.das.customer; + +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.util.ConfigUtil; +import org.apache.tuscany.samples.das.databaseSetup.DerbySetup; +import org.apache.tuscany.samples.das.databaseSetup.MySQLSetup; + +public class CustomerDatabaseInitializer { + public static final String DERBY = "derby"; + public static final String MYSQL = "mysql"; + + private final Config config; + + private final String dbType; + private final String dbURL; + private final String user; + private final String password; + + + + public CustomerDatabaseInitializer(String configFile) { + this.config = ConfigUtil.loadConfig(this.getClass().getClassLoader().getResourceAsStream(configFile)); + + if(config.getConnectionInfo().getConnectionProperties().getDriverClass().indexOf(DERBY) != -1) { + dbType = DERBY; + } else if(config.getConnectionInfo().getConnectionProperties().getDriverClass().indexOf(MYSQL) != -1) { + dbType = MYSQL; + } else { + dbType = null; + } + + //get connection info from config + dbURL = config.getConnectionInfo().getConnectionProperties().getDatabaseURL(); + user = config.getConnectionInfo().getConnectionProperties().getUserName(); + password = config.getConnectionInfo().getConnectionProperties().getPassword(); + } + + + + /** + * If database is present connect to it and create necessary tables, procedures, data etc. + * If database is not present create database and then create the above elements. Create database + * is implemented for MySQL and Derby. + */ + public void Initialize() { + + //display DB configuration iformation + DisplayDatabaseConfiguration(); + + //initialize DB + try { + if(dbType.equals(DERBY)){ + new DerbySetup(dbURL+"-"+user+"-"+password); + } + + if(dbType.equals(MYSQL)){ + new MySQLSetup(dbURL+"-"+user+"-"+password); + } + + } catch(Exception e){ + throw new RuntimeException("Error initializing database !", e); + } + } + + public void DisplayDatabaseConfiguration() { + + System.out.println("************* Initializing database *************"); + System.out.println("** DB type : " + dbType ); + System.out.println("** Database : " + dbURL ); + System.out.println("** User : " + user ); + System.out.println("** Password : " + password); + System.out.println("************************************************"); + } +} diff --git a/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetup.java b/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetup.java new file mode 100644 index 0000000000..4195dbcac7 --- /dev/null +++ b/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetup.java @@ -0,0 +1,206 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.samples.das.databaseSetup; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.Properties; +import java.util.StringTokenizer; + +public class DatabaseSetup{ + protected Statement s; + protected String platformName = "Not initialized"; + protected String driverName = "Not initialized"; + protected String databaseURL = "Not initialized"; + protected String databaseName = null; + protected String userName; + protected String password; + + // Data Types + public static final String stringType = "VARCHAR"; + public static final String integerType = "INT"; + public static final String timestampType = "TIMESTAMP"; + public static final String floatType = "FLOAT"; + public static final String decimalType = "DECIMAL"; + protected Connection connection; + + //database types + public static final String DERBY = "derby"; + public static final String MYSQL = "mysql"; + public static final String DB2 = "db2"; + + public DatabaseSetup(String databaseInfo){ + StringTokenizer strTok = new StringTokenizer(databaseInfo, "-"); + + if(strTok.hasMoreTokens()){ + databaseName = strTok.nextToken(); + } + + if(strTok.hasMoreTokens()){ + userName = strTok.nextToken(); + } + + if(strTok.hasMoreTokens()){ + password = strTok.nextToken(); + } + + initConnectionProtocol(databaseName); + initConnection(); + try{ + this.setUp(); + }catch(Exception e){ + e.printStackTrace(); + } + } + + protected void initConnectionProtocol( String databaseName){ + } + + private void initConnection() { + + try { + Class.forName(driverName).newInstance(); + Properties props = new Properties(); + //System.out.println("platform name:"+this.platformName); + + if(this.platformName.equals(DERBY)){ + if (userName != null) { + //System.out.println("derby trying for "+userName+","+password+","+databaseURL); + connection = DriverManager.getConnection(databaseURL, userName, password); + } else { + //System.out.println("derby trying for "+databaseURL); + connection = DriverManager.getConnection(databaseURL); + } + } + if(this.platformName.equals(DB2)){ + if (userName != null && password != null) { + props.put("user", userName); + props.put("password", password); + + //System.out.println("db2 trying for "+databaseURL+"user,pwd"+userName+","+password); + connection = DriverManager.getConnection(databaseURL, props); + }else{ + //System.out.println("db2 trying for "+databaseURL); + connection = DriverManager.getConnection(databaseURL); + } + } + if(this.platformName.equals(MYSQL)){ + databaseURL=databaseURL+"?user="+userName+"&password="+password+"&createDatabaseIfNotExist="+"true"; + //System.out.println("mysql trying for "+userName+","+password+","+databaseURL); + connection = DriverManager.getConnection(databaseURL, props); + } + + connection.setAutoCommit(true); + } catch (SQLException e) { + e.printStackTrace(); + if (e.getNextException() != null) { + e.getNextException().printStackTrace(); + } else { + e.printStackTrace(); + } + + throw new RuntimeException(e); + } catch (IllegalAccessException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } catch (InstantiationException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + public Connection getConnection(){ + return this.connection; + } + + protected void setUp() throws Exception { + System.out.println("Setting up for " + platformName + " run!"); + } + + private void insertData(){ + } + + private void dropTables() { + } + + protected void dropTriggers() { + } + + protected void createTriggers() { + } + + protected void dropSequences() { + } + + protected void createSequences() { + } + + protected void dropProcedures() { + } + + private void createTables() { + } + + protected void createProcedures() { + } + + // + // This section povides methods that return strings for table creation. + // Platform-specific sublcasses + // can override these as necessary + // + + protected String getCreateCustomer() { + return null; + } + // ///////////////// + + protected String getForeignKeyConstraint(String pkTable, String pkColumn, String foreignKey) { + return null; + } + + protected String getStringColumn(String name, int length) { + return null; + } + + protected String getIntegerColumn(String name) { + return null; + } + + protected String getGeneratedKeyClause() { + return null; + } + + protected String getDecimalColumn(String name, int size1, int size2) { + return null; + } + + protected String getFloatColumn(String name) { + return null; + } + + protected String getTimestampColumn(String name) { + return null; + } +} \ No newline at end of file diff --git a/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DerbySetup.java b/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DerbySetup.java new file mode 100644 index 0000000000..339cac3587 --- /dev/null +++ b/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DerbySetup.java @@ -0,0 +1,209 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.samples.das.databaseSetup; + +import java.sql.SQLException; + +public class DerbySetup extends DatabaseSetup { + + public DerbySetup(String databaseInfo){ + super(databaseInfo); + } + + protected void initConnectionProtocol(String databaseURL){ + this.platformName=DERBY; + this.driverName = "org.apache.derby.jdbc.EmbeddedDriver"; + this.databaseURL = databaseURL; + } + + public void setUp(){ + try{ + super.setUp(); + + try { + s = connection.createStatement(); + + dropTriggers(); + dropSequences(); + dropTables(); + dropProcedures(); + + createSequences(); + createTables(); + createTriggers(); + createProcedures(); + connection.commit(); + + insertData(); + connection.commit(); + } catch (SQLException e) { + connection.rollback(); + } + }catch(Exception e){ + e.printStackTrace(); + } + + System.out.println("Database setup complete!"); + } + + private void insertData(){ + System.out.println("Inserting data in tables"); + + String[] statements = {"INSERT INTO CUSTOMER VALUES (1,'John','USA')", + "INSERT INTO CUSTOMER VALUES (2,'Amita','INDIA')", + "INSERT INTO CUSTOMER VALUES (3,'Patrick','UK')", + "INSERT INTO CUSTOMER VALUES (4,'Jane','UN')"}; + + 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().indexOf("does not exist") >= 0)) && (!(e.getMessage().indexOf("Unknown table") >= 0)) + && (!(e.getMessage().indexOf("42704") >= 0))) { + throw new RuntimeException(e); + } + } + } + } + + private void dropTables() { + System.out.println("Dropping tables"); + String[] statements = {"DROP TABLE CUSTOMER" }; + + 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().indexOf("does not exist") >= 0)) && (!(e.getMessage().indexOf("Unknown table") >= 0)) + && (!(e.getMessage().indexOf("42704") >= 0))) { + throw new RuntimeException(e); + } + } + } + } + + protected void dropTriggers() { + + } + + protected void createTriggers() { + + } + + protected void dropSequences() { + + } + + protected void createSequences() { + + } + + protected void dropProcedures() { + + System.out.println("Dropping procedures"); + + String[] statements = {"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().indexOf("does not exist") >= 0) && !(e.getMessage().indexOf("42704") >= 0)) { + throw new RuntimeException(e); + } + } + } + } + + private void createTables() { + System.out.println("Creating tables"); + + try { + s.execute(getCreateCustomer()); + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + protected void createProcedures() { + + System.out.println("Creating procedures"); + try { + + 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.samples.das.orders.MyStoredProcs.getNamedCustomers'"); + } catch (SQLException e) { + e.printStackTrace(); + 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 (" + getIntegerColumn("ID") + " PRIMARY KEY NOT NULL, " + + getStringColumn("LASTNAME", 30) + + " DEFAULT 'Garfugengheist', " + getStringColumn("ADDRESS", 30) + ")"; + } + + protected String getForeignKeyConstraint(String pkTable, String pkColumn, String foreignKey) { + StringBuffer buffer = new StringBuffer(); + buffer.append("CONSTRAINT FK1 FOREIGN KEY ("); + buffer.append(foreignKey); + buffer.append(") REFERENCES "); + buffer.append(pkTable); + buffer.append("("); + buffer.append(pkColumn); + buffer.append(") ON DELETE NO ACTION ON UPDATE NO ACTION"); + return buffer.toString(); + } + + protected String getStringColumn(String name, int length) { + return name + ' ' + stringType + "(" + new Integer(length).toString() + ")"; + } + + protected String getIntegerColumn(String name) { + return name + ' ' + integerType; + } + + protected String getGeneratedKeyClause() { + return "GENERATED ALWAYS AS IDENTITY"; + } + + protected String getDecimalColumn(String name, int size1, int size2) { + return name + ' ' + decimalType + "(" + new Integer(size1).toString() + ',' + + new Integer(size2).toString() + ")"; + } + + protected String getFloatColumn(String name) { + return name + ' ' + floatType; + } + + protected String getTimestampColumn(String name) { + return name + ' ' + timestampType; + } +} diff --git a/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/MySQLSetup.java b/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/MySQLSetup.java new file mode 100644 index 0000000000..f64b16e2db --- /dev/null +++ b/das-java/trunk/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/MySQLSetup.java @@ -0,0 +1,211 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.samples.das.databaseSetup; + +import java.sql.SQLException; + +public class MySQLSetup extends DatabaseSetup { + + public MySQLSetup(String databaseInfo){ + super(databaseInfo); + } + + protected void initConnectionProtocol(String databaseURL){ + this.platformName=MYSQL; + this.driverName = "com.mysql.jdbc.Driver"; + this.databaseURL = databaseURL; + } + + public void setUp(){ + try{ + super.setUp(); + + try { + s = connection.createStatement(); + + dropTriggers(); + dropSequences(); + dropTables(); + dropProcedures(); + + createSequences(); + createTables(); + createTriggers(); + createProcedures(); + insertData(); + } catch (SQLException e) { + e.printStackTrace(); + } + }catch(Exception e){ + e.printStackTrace(); + } + + System.out.println("Database setup complete!"); + } + + private void insertData(){ + System.out.println("Inserting data in tables"); + + String[] statements = {"INSERT INTO CUSTOMER VALUES (1,'John','USA')", + "INSERT INTO CUSTOMER VALUES (2,'Amita','INDIA')", + "INSERT INTO CUSTOMER VALUES (3,'Patrick','UK')", + "INSERT INTO CUSTOMER VALUES (4,'Jane','UN')"}; + + 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().indexOf("does not exist") >= 0)) && (!(e.getMessage().indexOf("Unknown table") >= 0)) + && (!(e.getMessage().indexOf("42704") >= 0))) { + throw new RuntimeException(e); + } + } + } + } + + private void dropTables() { + System.out.println("Dropping tables"); + + String[] statements = {"DROP TABLE CUSTOMER"}; + + 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().indexOf("does not exist") >= 0)) && (!(e.getMessage().indexOf("Unknown table") >= 0)) + && (!(e.getMessage().indexOf("42704") >= 0))) { + throw new RuntimeException(e); + } + } + } + } + + protected void dropTriggers() { + + } + + protected void createTriggers() { + + } + + protected void dropSequences() { + + } + + protected void createSequences() { + + } + + protected void dropProcedures() { + + System.out.println("Dropping procedures"); + + String[] statements = {"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().indexOf("does not exist") >= 0) && !(e.getMessage().indexOf("42704") >= 0)) { + throw new RuntimeException(e); + } + } + } + } + + private void createTables() { + System.out.println("Creating tables"); + + try { + + s.execute(getCreateCustomer()); + + } 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 (" + getIntegerColumn("ID") + " PRIMARY KEY NOT NULL, " + + getStringColumn("LASTNAME", 30) + + " DEFAULT 'Garfugengheist', " + getStringColumn("ADDRESS", 30) + ")"; + } + + // ///////////////// + + protected String getForeignKeyConstraint(String pkTable, String pkColumn, String foreignKey) { + StringBuffer buffer = new StringBuffer(); + buffer.append("CONSTRAINT FK1 FOREIGN KEY ("); + buffer.append(foreignKey); + buffer.append(") REFERENCES "); + buffer.append(pkTable); + buffer.append("("); + buffer.append(pkColumn); + buffer.append(") ON DELETE NO ACTION ON UPDATE NO ACTION"); + return buffer.toString(); + } + + protected String getStringColumn(String name, int length) { + return name + ' ' + stringType + "(" + new Integer(length).toString() + ")"; + } + + protected String getIntegerColumn(String name) { + return name + ' ' + integerType; + } + + protected String getDecimalColumn(String name, int size1, int size2) { + return name + ' ' + decimalType + "(" + new Integer(size1).toString() + ',' + + new Integer(size2).toString() + ")"; + } + + protected String getFloatColumn(String name) { + return name + ' ' + floatType; + } + + protected String getTimestampColumn(String name) { + return name + ' ' + timestampType; + } + + protected void createProcedures() { + 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 "; + + System.out.println("Creating procedures"); + try { + s.execute(createGetNamedCustomers); + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + protected String getGeneratedKeyClause() { + return "AUTO_INCREMENT"; + } +} diff --git a/das-java/trunk/samples/customer/src/main/resources/CustomersConfig.xml b/das-java/trunk/samples/customer/src/main/resources/CustomersConfig.xml new file mode 100644 index 0000000000..41fa03ba2b --- /dev/null +++ b/das-java/trunk/samples/customer/src/main/resources/CustomersConfig.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + +
+ + + + + + +
diff --git a/das-java/trunk/samples/customer/src/main/resources/META-INF/LICENSE b/das-java/trunk/samples/customer/src/main/resources/META-INF/LICENSE new file mode 100644 index 0000000000..fb4df3722c --- /dev/null +++ b/das-java/trunk/samples/customer/src/main/resources/META-INF/LICENSE @@ -0,0 +1,353 @@ + + 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. + +=============================================================================================================== + +Other components and dependencies under Apache Software License 2.0 : + + log4j-1.2.14.jar - Apache Logging Services + derby 10.2.2.0.jar - Apache Derby + stax-api-1.0.1.jar - The Streaming API for XML (StAX) + wstx-asl-3.2.0.jar - WoodStox StAX implementation + standard-1.1.1.jar - The Apache Jackarta Taglibs + jstl-1.1.2.jar - The Apache Jackarta Taglibs + *.tld - The Apache Jackarta Taglibs + +=============================================================================================================== + + +Apache Tuscany SDO for Java Subcomponents +=========================================: + +The Tuscany SDO for Java release 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. + +License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar) + +Permission to copy, make derivative works of, and distribute the Service Data Objects +JavaDoc and Interface Definition Files files in any medium without fee or royalty as part +of a compliant implementation of the Service Data Objects Specification is hereby granted. +The Service Data Objects Specification may be found at any of the following locations: + +http://dev2dev.bea.com/technologies/commonj/index.jsp +http://www.ibm.com/developerworks/library/specification/ws-sdo/ +http://oracle.com/technology/webservices/sca +https://www.sdn.sap.com/ +http://www.xcalia/xdn/specs/sdo + +THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES +ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS +SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS, +INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE +SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES. + +The name and trademarks of the Authors may NOT be used in any manner, including advertising or +publicity pertaining to the Service Component Architecture Specification or its contents without specific, +written prior permission. Title to copyright in the Service Data Objects Specification and the +JavaDoc and Interface Definition Files will at all times remain with the Authors. + +No other rights are granted by implication, estoppel or otherwise. + +================================================================================================================= + +For the Eclipse EMF components +(codegen-2.2.3.jar +codegen-ecore-2.2.3.jar +common-2.2.3.jar +ecore-2.2.3.jar +ecore-change-2.2.3.jar +ecore-xmi-2.2.3.jar +xsd-2.2.3.jar) + +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. + +=================================================================================================== diff --git a/das-java/trunk/samples/customer/src/main/resources/META-INF/NOTICE b/das-java/trunk/samples/customer/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..c2cf1f95b4 --- /dev/null +++ b/das-java/trunk/samples/customer/src/main/resources/META-INF/NOTICE @@ -0,0 +1,32 @@ +Apache Tuscany SDO for Java +Copyright 2006, 2007 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF), +sponsored by the Apache 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. + +Unless otherwise indicated, all distribution made available by the Apache Software Foundation +is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL"). +A copy of the AL is provided with this distribution as the LICENSE.txt file present in the +root directory, and is also available at http://www.apache.org/licenses/. + +The terms and conditions governing the distribution may refer to the AL or other license +agreements, notices or terms and conditions. Some of these other license agreements may +include (but are not limited to): + + . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html) + +It is your obligation to read and accept all such terms and conditions prior to use of the +distribution. If term or condition is provided, please contact the Apache Software Foundation +to determine what terms and conditions govern that particular distribution. + +This product also includes software developed by the Open Service Oriented Architecture organisation +(http://osoa.org). The license for this software may be found in the LICENSE.txt file contained in this +distribution. diff --git a/das-java/trunk/samples/customer/src/main/resources/META-INF/README b/das-java/trunk/samples/customer/src/main/resources/META-INF/README new file mode 100644 index 0000000000..d1905ee3e8 --- /dev/null +++ b/das-java/trunk/samples/customer/src/main/resources/META-INF/README @@ -0,0 +1,35 @@ +Apache Tuscany M2 build (October, 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/das-java/trunk/samples/customer/src/main/resources/log4j.properties b/das-java/trunk/samples/customer/src/main/resources/log4j.properties new file mode 100644 index 0000000000..ab4ebbb785 --- /dev/null +++ b/das-java/trunk/samples/customer/src/main/resources/log4j.properties @@ -0,0 +1,36 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# +# Set root logger level to DEBUG and its only appender to A1. +log4j.rootLogger=INFO, NULL + +# NULL Appender +log4j.appender.NULL=org.apache.log4j.varia.NullAppender + +log4j.appender.NULL.layout=org.apache.log4j.PatternLayout +log4j.appender.NULL.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n + +# CONSOLE is set to be a ConsoleAppender. +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n + + +# Print only messages of level WARN or above in the package com.foo. +log4j.logger.org.apache.tuscany=NONE \ No newline at end of file diff --git a/das-java/trunk/samples/dbconfig/pom.xml b/das-java/trunk/samples/dbconfig/pom.xml new file mode 100644 index 0000000000..372bcbc302 --- /dev/null +++ b/das-java/trunk/samples/dbconfig/pom.xml @@ -0,0 +1,123 @@ + + + + 4.0.0 + + org.apache.tuscany.das.samples + tuscany-das-samples + 1.0-SNAPSHOT + + + tuscany-das-sample-dbconfig + jar + Tuscany DAS Canned DB Initializer Utility + + + + org.apache.tuscany.das + tuscany-das-rdb + ${das.version} + compile + + + + org.apache.tuscany.sdo + tuscany-sdo-impl + ${sdo.version} + compile + + + + org.apache.tuscany.sdo + tuscany-sdo-api-r2.1 + ${sdo.version} + compile + + + + org.apache.derby + derby + 10.2.2.0 + compile + + + + log4j + log4j + 1.2.14 + compile + + + + junit + junit + 3.8.1 + test + + + + + + sample-dbconfig + src/main/java + + + src/main/java + + + src/main/resources + + + + + + org.apache.tuscany.sdo + tuscany-sdo-plugin + ${sdo.version} + + + config + + ${basedir}/src/main/resources/DBConfig.xsd + true + true + + + generate + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*TestCase.java + + + + + + + + + diff --git a/das-java/trunk/samples/dbconfig/readme.html b/das-java/trunk/samples/dbconfig/readme.html new file mode 100644 index 0000000000..da8c83a824 --- /dev/null +++ b/das-java/trunk/samples/dbconfig/readme.html @@ -0,0 +1,153 @@ + + + + + + +Tuscany RDB DAS Database Setup Utility + + + + + +

Tuscany RDB DAS Database Setup Utility

+ +
+ +

This utility provides a jar file to be used by RDB DAS sample +applications (web or standalone) to do database setup. So far the +samples provided canned pre-created Derby database with tables and data. +There was no convenient way to refresh table data during the samples +execution. This utility supports Derby database at present and uses a +config file to get the setup information.

+ +

APIs

+ +
    +public DBInitializer() – uses default provided ConfigFile CannedSampleDBConfig.xml
    +public DBInitializer(String ConfigFileLocation)
    +public DBInitializer (InputStream ConfigFileStream)
    +public void initializeDatabase(boolean clean) - Create database tables and fill data. If clean=true, all tables will be dropped and recreated.
    +public void initializeDatabaseData(boolean clean) - create database data (with clean=true, if a table has pre-existing data, it will be deleted first)
    +public void refreshDatabaseData() – calls initializeDatabase(clean=true)
    +public boolean isDatabaseReady() - will return true, if the tables exist in the database
    +public boolean isDatabasePopulated() - will return true, if the tables have data
    +
+ +

Assumptions:

+

<table> element lists tables in proper sequence, i.e. parent tables +first and then child tables. This sequence will be used in +create,insert,delete,drop to take care of referential integrity. The +config file required by utility supports the following features through +different attributes and elements. Sample xml file is shown at the end. + +

+ +

<ConnectionInfo>

+

This element provides connection specific information - like vendor +specific database URL, user name, password etc. If the DataSource is +provided by the web container, user needs to only fill dataSource +attribute in this. In case of standalone J2SE samples, user needs to +fill ConnectionProperties element inside ConnectionInfo. These two ways +of connection specification are mutually exclusive.

+ +

<table>

+

This element needs to specify the table names required by the +sample. Only these tables will be considered for creation, data +population. This gives flexibility to the user to choose the required +set of tables based on the sample's requirement. It also needs to +specify in the attributes, the Create SQL command used to create this +table.<table> has sequence element <row> which is used to provide +the data to be populated in the table. +

+ +

Set Up

+ +

To use this utility, include its jar and required database + driver's jar in the classpath. Provide the config file used by this + utility , similar to the example below, in the source folder of the + sample.
+

+ +

DBConfig.xml example

+ +
    + <?xml version="1.0" encoding="ASCII"?>
    + <!-- Licensed to the Apache Software Foundation (ASF) under one or + more contributor license agreements. See the NOTICE file distributed + with this work for additional information regarding copyright + ownership. The ASF licenses this file to you 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. -->

    + <DBConfig + xmlns="http:///org.apache.tuscany.das.rdb/dbconfig.xsd">

    + <ConnectionInfo>
    + <ConnectionProperties + driverClass="org.apache.derby.jdbc.EmbeddedDriver" + databaseURL="jdbc:derby:target/dastest; create = true" + loginTimeout="600000" />
    + </ConnectionInfo>

    + <Table + name="COMPANY" SQLCreate="CREATE TABLE COMPANY (ID INT PRIMARY KEY NOT + NULL, NAME VARCHAR(30), EOTMID INTEGER)">
    + <row> 51, 'ACME Publishing', 0 </row>
    + <row> 52, 'Do-rite plumbing', 0 </row>
    + <row> 53, 'MegaCorp', 0 </row>
    + </Table>

    + <Table name="DEPARTMENT" SQLCreate="CREATE TABLE DEPARTMENT (ID INT + PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY, NAME + VARCHAR(30),LOCATION VARCHAR(30), DEPNUMBER VARCHAR(10),COMPANYID + INT)">
    + <row> 'Advanced Technologies', 'NY', '123', 1 </row>
    + <row> 'Default Name', '', '', 51 </row>
    + <row> 'Default Name', '', '', 51 </row>
    + <row> 'Default Name', '', '', 51 </row>
    + <row> 'Default Name', '', '', 51 </row>
    + <row> 'Default Name', '', '', 51 </row>
    + <row> 'Default Name', '', '', 51 </row>
    + </Table>

    + + <Table name="EMPLOYEE" SQLCreate="CREATE TABLE EMPLOYEE (ID INT + PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY,NAME VARCHAR(30),SN + VARCHAR(10), MANAGER SMALLINT, DEPARTMENTID INT)">
    + <row> 'John Jones','E0001',0,12 </row>
    + <row> 'Mary Smith','E0002',1,null </row>
    + <row> 'Jane Doe','E0003',0,12 </row>
    + <row> 'Al Smith','E0004',1,12 </row>
    + </Table>

    </DBConfig>
    + +
+ + + + diff --git a/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConfigUtil.java b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConfigUtil.java new file mode 100644 index 0000000000..783f822bc4 --- /dev/null +++ b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConfigUtil.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dbconfig; + + +import java.io.IOException; +import java.io.InputStream; + +import commonj.sdo.helper.HelperContext; +import commonj.sdo.helper.XMLHelper; +import commonj.sdo.impl.HelperProvider; + +/** + * Config util provides config-related utilities such as loading a Config + * instance from an InputStream + * + */ +public final class DBConfigUtil { + + private DBConfigUtil() { + } + + public static DBConfig loadDBConfig(InputStream dbconfigStream) { + + if (dbconfigStream == null) { + throw new RuntimeException("Cannot load configuration from a null InputStream. " + + "Possibly caused by an incorrect config xml file name"); + } + + HelperContext context = HelperProvider.getDefaultContext(); + DbconfigFactory.INSTANCE.register(context); + XMLHelper helper = context.getXMLHelper(); + + try { + return (DBConfig) helper.load(dbconfigStream).getRootObject(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + +} diff --git a/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConnectionHelper.java b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConnectionHelper.java new file mode 100644 index 0000000000..5f64145c58 --- /dev/null +++ b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConnectionHelper.java @@ -0,0 +1,179 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dbconfig; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.sql.DataSource; + +import org.apache.log4j.Level; +import org.apache.log4j.Logger; + +public class DBConnectionHelper { + private static final Logger logger = Logger.getLogger(DBConnectionHelper.class); + + protected DBConnectionHelper(){ + if(logger.isDebugEnabled()) { + logger.log(Level.DEBUG, "DBConnectionHelper()"); + } + } + + /** + * Basic validation of Config for connection information and call to + * connection helper to establish database connection. Connection using + * DriverManager or DataSource are supported. + * + */ + public static Connection createConnection(ConnectionInfo connectionInfo) { + if (logger.isDebugEnabled()) { + logger.log(Level.DEBUG, "DBConnectionHelper.createConnection(ConnectionInfo)"); + } + + if (connectionInfo == null || + (connectionInfo.getDataSource() == null && + (connectionInfo.getConnectionProperties() == null || connectionInfo.getConnectionProperties().getDatabaseURL() == null + || connectionInfo.getConnectionProperties().getDriverClass() == null)) ) { + throw new RuntimeException("No connection has been provided and no data source has been specified"); + } + + if(connectionInfo.getDataSource() != null && + (connectionInfo.getConnectionProperties() != null && connectionInfo.getConnectionProperties().getDatabaseURL() != null) ){ + throw new RuntimeException("Use either dataSource or databaseURL. Can't use both !"); + } + + Connection connection = null; + + if(connectionInfo.getDataSource() != null){ + connection = initializeDatasourceConnection(connectionInfo); + }else{ + connection = initializeDriverManagerConnection(connectionInfo); + } + + return connection; + + } + /** + * Initializes a DB connection on a managed environmet (e.g inside Tomcat) + */ + private static Connection initializeDatasourceConnection(ConnectionInfo connectionInfo){ + if (logger.isDebugEnabled()) { + logger.log(Level.DEBUG, "DBConnectionHelper.initializeDatasourceConnection(ConnectionInfo)"); + } + + InitialContext ctx; + Connection connection; + + try { + ctx = new InitialContext(); + } catch (NamingException e) { + throw new RuntimeException(e); + } + try { + DataSource ds = (DataSource) ctx.lookup(connectionInfo.getDataSource()); + try { + try { + if(connectionInfo.getConnectionProperties() != null && + connectionInfo.getConnectionProperties().getUserName() != null && + connectionInfo.getConnectionProperties().getPassword() != null ) { + connection = ds.getConnection(connectionInfo.getConnectionProperties().getUserName(), connectionInfo.getConnectionProperties().getPassword()); + } else { + connection = ds.getConnection(); + } + }catch(Exception e) { + connection = ds.getConnection(); + } + + if (connection == null) { + throw new RuntimeException("Could not obtain a Connection from DataSource"); + } + connection.setAutoCommit(true); + + } catch (SQLException e) { + throw new RuntimeException(e); + } + } catch (NamingException e) { + throw new RuntimeException(e); + } + + if( logger.isDebugEnabled()) { + logger.log(Level.DEBUG, "DBConnectionHelper.initializeDatasourceConnection() exit"); + } + return connection; + } + + /** + * Initialize a DB connection on a J2SE environment + * For more info, see http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/drivermanager.html + */ + private static Connection initializeDriverManagerConnection(ConnectionInfo connectionInfo) { + if (logger.isDebugEnabled()) { + logger.log(Level.DEBUG, "DBConnectionHelper.initializeDriverManagerConnection(ConnectionInfo)"); + } + + if (connectionInfo.getConnectionProperties() == null) { + throw new DataSourceInitializationException("No existing context and no connection properties"); + } + + if (connectionInfo.getConnectionProperties().getDriverClass() == null) { + throw new DataSourceInitializationException("No jdbc driver class specified!"); + } + + Connection connection; + + try { + //initialize driver and register it with DriverManager + Class.forName(connectionInfo.getConnectionProperties().getDriverClass()); + + //prepare to initialize connection + String databaseUrl = connectionInfo.getConnectionProperties().getDatabaseURL(); + String userName = connectionInfo.getConnectionProperties().getUserName(); + String userPassword = connectionInfo.getConnectionProperties().getPassword(); + int loginTimeout = connectionInfo.getConnectionProperties().getLoginTimeout(); + + DriverManager.setLoginTimeout(loginTimeout); + if( (userName == null || userName.length() ==0) && (userPassword == null || userPassword.length()==0) ){ + //no username or password suplied + connection = DriverManager.getConnection(databaseUrl); + }else{ + connection = DriverManager.getConnection(databaseUrl, userName, userPassword); + } + + if(connection == null){ + throw new DataSourceInitializationException("Error initializing connection : null"); + } + + connection.setAutoCommit(true); + }catch(ClassNotFoundException cnf){ + throw new DataSourceInitializationException("JDBC Driver '" + connectionInfo.getConnectionProperties().getDriverClass() + "' not found", cnf); + }catch(SQLException sqle){ + throw new DataSourceInitializationException(sqle.getMessage(), sqle); + } + + if (logger.isDebugEnabled()) { + logger.log(Level.DEBUG, "DBConnectionHelper.initializeDriverManagerConnection() exit"); + } + + return connection; + } +} diff --git a/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBDataHelper.java b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBDataHelper.java new file mode 100644 index 0000000000..2ef25bdf81 --- /dev/null +++ b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBDataHelper.java @@ -0,0 +1,251 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dbconfig; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.Iterator; +import java.util.List; + +import org.apache.log4j.Level; +import org.apache.log4j.Logger; + +public class DBDataHelper { + private static final String CLASS_NAME = "DBDataHelper"; + + private final Logger logger = Logger.getLogger(DBDataHelper.class); + + private final DBConfig dbConfig; + + protected DBDataHelper(DBConfig dbConfig) { + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, "DBDataHelper()"); + } + + this.dbConfig = dbConfig; + } + + public boolean isDatabasePopulated() { + boolean isPopulated = true; + + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, CLASS_NAME + ".isDatabasePopulated()"); + } + + Iterator tableIterator = dbConfig.getTable().iterator(); + while (tableIterator.hasNext()) { + Table table = (Table) tableIterator.next(); + + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, CLASS_NAME + ".isDatabasePopulated() calling isTablePopulated() for '" + table.getName() + "'"); + } + + isPopulated = this.isTablePopulated(table.getName()); + if (isPopulated == false) { + break; + } + } + return isPopulated; + } + + /** + * + * @param tableName + * @return Count of rows present in the table specified by tableName + */ + protected boolean isTablePopulated(String tableName) { + boolean isPopulated = false; + Connection dbConnection = null; + Statement dbStatement = null; + + try { + dbConnection = DBConnectionHelper.createConnection(dbConfig.getConnectionInfo()); + dbStatement = dbConnection.createStatement(); + String sqlString = "select count(*) from " + tableName; + + this.logger.log(Level.DEBUG, CLASS_NAME + ".isTablePopulated()=> sqlString => '" + sqlString + "'"); + + ResultSet rs = dbStatement.executeQuery(sqlString); + rs.next(); + + if (rs != null) { + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, CLASS_NAME + ".isTablePopulated()=> pointer set"); + } + } + + int count = rs.getInt(1); + + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, CLASS_NAME + ".isTablePopulated()=> '" + tableName + "' => " + count); + } + + if (count > 0) { + isPopulated = true; + } + + } catch (SQLException e) { + // ignore and return false + } finally { + try { + dbStatement.close(); + dbConnection.close(); + } catch (SQLException e1) { + // ignore and return false + } + } + + return isPopulated; + } + + protected String generateInsertSQL(Connection dbConnection, String tableName, String rowValues) throws SQLException { + StringBuffer sqlBuffer = new StringBuffer(50); + + Statement dbStatement = dbConnection.createStatement(); + ResultSet dummyRS = dbStatement.executeQuery("SELECT * FROM "+tableName); + ResultSetMetaData rsMetaData = dummyRS.getMetaData(); + + + sqlBuffer.append("INSERT INTO ").append(tableName).append(" ("); + + int numberOfColumns = rsMetaData.getColumnCount(); + String columnName = null; + int i; + for (i = 1; i <= numberOfColumns -1; i++) { + //get the column's name. + columnName = rsMetaData.getColumnName(i); + if(!rsMetaData.isAutoIncrement(i)){ + sqlBuffer.append(columnName).append(","); + } + else{ + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, CLASS_NAME + ".initializeDatabaseData()=> auto increment column => " + i + " "+columnName); + } + } + } + sqlBuffer.append(rsMetaData.getColumnName(i)).append(") "); + sqlBuffer.append("VALUES (").append(rowValues).append(")"); + + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, CLASS_NAME + ".initializeDatabaseData()=> SQL Clause => " + sqlBuffer); + } + + return sqlBuffer.toString(); + } + + public void initializeDatabaseData() { + Connection dbConnection = null; + Statement dbStatement = null; + + try { + dbConnection = DBConnectionHelper.createConnection(dbConfig.getConnectionInfo()); + dbStatement = dbConnection.createStatement(); + + Iterator tableIterator = dbConfig.getTable().iterator(); + while (tableIterator.hasNext()) { + Table table = (Table) tableIterator.next(); + + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, CLASS_NAME + ".initializeDatabaseData()=> INSERT FOR TABLE => '" + table.getName() + "'"); + } + + //String columnClause = generateInsertSQL(dbConnection, table.getName()); + + String tableName = table.getName(); + Iterator dataIterator = table.getRow().iterator(); + while (dataIterator.hasNext()) { + String tableRow = (String) dataIterator.next(); + String sqlString = generateInsertSQL(dbConnection, tableName, tableRow); + + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, CLASS_NAME + ".initializeDatabaseData()=> sqlString => '" + sqlString + "'"); + } + + try { + dbStatement.executeUpdate(sqlString); + }catch(SQLException e){ + //e.printStackTrace(); + //ignore and jump to new table + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, CLASS_NAME + ".initializeDatabaseData() - Error inserting table data : " + e.getMessage(), e); + } + } + } + } + } catch (SQLException e) { + // ignore and return false + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, CLASS_NAME + ".initializeDatabaseData() - Internal error : " + e.getMessage(), e); + } + } finally { + try { + dbStatement.close(); + dbConnection.close(); + } catch (SQLException e1) { + // ignore and return false + } + } + } + + public void deleteDatabaseData() { + Connection dbConnection = null; + Statement dbStatement = null; + + try { + dbConnection = DBConnectionHelper.createConnection(dbConfig.getConnectionInfo()); + dbStatement = dbConnection.createStatement(); + //inverse order - to take care of parent-child + List tables = dbConfig.getTable(); + for(int i=tables.size()-1; i>-1; i-- ){ + Table table = (Table) tables.get(i); + String sqlString = "DELETE FROM " + table.getName() ; + + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, CLASS_NAME + ".deleteDatabaseData()=> sqlString => '" + sqlString + "'"); + } + + try { + dbStatement.executeQuery(sqlString); + }catch(SQLException e){ + e.printStackTrace(); + //ignore and jump to new table + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, CLASS_NAME + ".deleteDatabaseData() - Error inserting table data : " + e.getMessage(), e); + } + } + } + } catch (SQLException e) { + // ignore and return false + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, CLASS_NAME + ".initializeDatabaseData() - Internal error : " + e.getMessage(), e); + } + } finally { + try { + dbStatement.close(); + dbConnection.close(); + } catch (SQLException e1) { + // ignore and return false + } + } + } +} diff --git a/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBHelper.java b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBHelper.java new file mode 100644 index 0000000000..028ec59d63 --- /dev/null +++ b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBHelper.java @@ -0,0 +1,200 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dbconfig; + +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.Iterator; + +import org.apache.log4j.Level; +import org.apache.log4j.Logger; + +public class DBHelper { + private static final String CLASS_NAME = "DBHelper"; + + private final Logger logger = Logger.getLogger(DBHelper.class); + + private final DBConfig dbConfig; + + /** + * Constructor + * + * @param DBConfig + */ + protected DBHelper(DBConfig dbConfig) { + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, CLASS_NAME + "()"); + } + this.dbConfig = dbConfig; + } + + /** + * Check if tables specified in Config exist + * + * @return true if all specified tables exist, false otherwise + */ + protected boolean isDatabaseReady() { + boolean bResult = true; + + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, CLASS_NAME + "isDatabaseReady()"); + } + + Connection dbConnection = null; + DatabaseMetaData dbMetaData = null; + try { + dbConnection = DBConnectionHelper.createConnection(dbConfig.getConnectionInfo()); + dbMetaData = dbConnection.getMetaData(); + + if (dbConfig.getTable() != null && dbConfig.getTable().size() > 0) { + Iterator tableIterator = dbConfig.getTable().iterator(); + while (tableIterator.hasNext()) { + Table table = (Table) tableIterator.next(); + + if (!dbMetaData.getTables(null, null, table.getName(), null).next()) { + bResult = false; + } + + } + } + } catch (SQLException e) { + bResult = false; + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, "Error retrieving database metadata", e); + } + } finally { + try { + if(dbConnection != null) dbConnection.close(); + } catch (SQLException e) { + // ignore here + } + } + + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, CLASS_NAME + "isDatabaseReady() exit"); + } + + return bResult; + } + + /** + * Create the database tables based on dbConfig definition + */ + protected void initializeDatabase() { + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, CLASS_NAME + "initializeDatabase()"); + } + + Connection dbConnection = null; + Statement dbStatement = null; + try { + dbConnection = DBConnectionHelper.createConnection(dbConfig.getConnectionInfo()); + dbStatement = dbConnection.createStatement(); + + if (dbConfig.getTable() != null && dbConfig.getTable().size() > 0) { + Iterator tableIterator = dbConfig.getTable().iterator(); + while (tableIterator.hasNext()) { + Table table = (Table) tableIterator.next(); + + if (table.getSQLCreate() != null && table.getSQLCreate().length() > 0) { + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, "Creating table '" + table.getName() + "' => " + table.getSQLCreate()); + } + + dbStatement.execute(table.getSQLCreate()); + } + } + } + } catch (SQLException e) { + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, "Error retrieving database metadata", e); + } + } finally { + try { + dbStatement.close(); + dbConnection.close(); + } catch (SQLException e) { + // ignore here + } + } + + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, CLASS_NAME + "initializeDatabase() exit"); + } + } + + /** + * Drop the database tables based on dbConfig definition + */ + protected void dropDatabaseTables() { + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, CLASS_NAME + "dropDatabaseTables()"); + } + + Connection dbConnection = null; + Statement dbStatement = null; + try { + dbConnection = DBConnectionHelper.createConnection(dbConfig.getConnectionInfo()); + dbStatement = dbConnection.createStatement(); + + if (dbConnection != null && dbStatement != null && dbConfig.getTable() != null && dbConfig.getTable().size() > 0) { + //reverse order to take care of dropping child tables before parent tables. + for(int i=dbConfig.getTable().size()-1; i>-1; i--) { + Table table = (Table) dbConfig.getTable().get(i); + + if (table.getSQLCreate() != null && table.getSQLCreate().length() > 0) { + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, "Dropping table '" + table.getName() ); + } + + try { + dbStatement.execute("DROP TABLE " + table.getName()); + } catch (SQLException e) { + //ignore + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, "Error droping table '" + table.getName() + "'", e); + } + } + } + } + } + } catch (SQLException e) { + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, "Error droping table", e); + } + } finally { + try { + if(dbStatement != null) + dbStatement.close(); + + if(dbConnection != null) + dbConnection.close(); + } catch (SQLException e) { + // ignore here + } + } + + if (logger.isDebugEnabled()) { + this.logger.log(Level.DEBUG, CLASS_NAME + "dropDatabaseTables() exit"); + } + } +} diff --git a/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializer.java b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializer.java new file mode 100644 index 0000000000..cc6a670dfd --- /dev/null +++ b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializer.java @@ -0,0 +1,154 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dbconfig; + +import java.io.InputStream; +import java.sql.Connection; + +/** + * This is the master class having public utility APIs exposed for DAS sample creater - for table and data maintainance. + * + */ +public class DBInitializer { + private static final String DEFAULT_CANNED_DB_CONFIGURATION = "CannedSampleDBConfig.xml"; + + /** + * Database configuration model + */ + protected DBConfig dbConfig; + + /** + * Database connection + */ + protected Connection connection; + + /** + * To manage database connection + */ + protected DBConnectionHelper dbConnectionHelper; + + /** + * To manage database phisical structure + */ + protected DBHelper dbHelper; + + /** + * To manage database population + */ + protected DBDataHelper dbDataHelper; + + /** + * Create instance of DBInitHelper based on default canned database configuration + * + * @param dbconfigFileLocation + * @throws Exception + */ + public DBInitializer() { + InputStream dbConfigStream = this.getClass().getClassLoader().getResourceAsStream(DEFAULT_CANNED_DB_CONFIGURATION); + init(dbConfigStream); + } + + /** + * Create instance of DBInitHelper based on Config file location + * + * @param dbconfigFileLocation + * @throws Exception + */ + public DBInitializer(String dbconfigFileLocation) throws Exception { + InputStream dbConfigStream = this.getClass().getClassLoader().getResourceAsStream(dbconfigFileLocation); + init(dbConfigStream); + } + + /** + * Create instance of DBInitHelper based on Config stream + * + * @param dbconfigStream + * @throws Exception + */ + public DBInitializer(InputStream dbConfigStream) throws Exception { + init(dbConfigStream); + } + + /** + * Initialize helper members based on Config + * + * @param dbconfigStream + */ + protected void init(InputStream dbconfigStream) { + dbConfig = DBConfigUtil.loadDBConfig(dbconfigStream); + + dbConnectionHelper = new DBConnectionHelper(); + dbHelper = new DBHelper(dbConfig); + dbDataHelper = new DBDataHelper(dbConfig); + + } + + /** + * Check if the Database and all tables have been created on the database + * + * @return return true if tables exist, else return false. + */ + public boolean isDatabaseReady() { + return dbHelper.isDatabaseReady(); + } + + /** + * + * @return - return true if all tables have at least a row, false otherwise + */ + public boolean isDatabasePopulated() { + return dbDataHelper.isDatabasePopulated(); + } + + /** + * Create tables and populate data. + * + * @param clean - If true, tables will be force dropped and recreated, else it will skip table creation for pre-existing tables. + * @throws Exception + */ + public void initializeDatabase(boolean clean) throws DatabaseInitializerException { + if (clean) { + dbHelper.dropDatabaseTables(); + } + dbHelper.initializeDatabase(); + dbDataHelper.initializeDatabaseData(); + } + + /** + * Populate database data + * + * @param clean If true, table data will be droped before data is created + */ + public void initializeDatabaseData(boolean clean) throws DatabaseInitializerException{ + if (clean) { + dbDataHelper.deleteDatabaseData(); + } + dbDataHelper.initializeDatabaseData(); + } + + /** + * Refresh data in tables. + * + * @throws Exception + */ + public void refreshDatabaseData() throws DatabaseInitializerException { + initializeDatabase(true); + } +} diff --git a/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DataSourceInitializationException.java b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DataSourceInitializationException.java new file mode 100644 index 0000000000..ef5bef7761 --- /dev/null +++ b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DataSourceInitializationException.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dbconfig; + +/** + * + * Class responsible to throw exception encountered when initializing DataSource. + * + */ +public class DataSourceInitializationException extends RuntimeException { + private static final long serialVersionUID = 302160989411041041L; + + public DataSourceInitializationException(String string) { + super(string); + } + + public DataSourceInitializationException(Throwable e){ + super(e); + } + + public DataSourceInitializationException(String string, Throwable e) { + super(string, e); + } +} diff --git a/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DatabaseInitializerException.java b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DatabaseInitializerException.java new file mode 100644 index 0000000000..8c4fd0d71b --- /dev/null +++ b/das-java/trunk/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DatabaseInitializerException.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dbconfig; + +/** + * + * Class responsible to throw exception encountered when initializing DataSource. + * + */ +public class DatabaseInitializerException extends RuntimeException { + private static final long serialVersionUID = 302160989411041041L; + + public DatabaseInitializerException(String string) { + super(string); + } + + public DatabaseInitializerException(Throwable e){ + super(e); + } + + public DatabaseInitializerException(String string, Throwable e) { + super(string, e); + } +} diff --git a/das-java/trunk/samples/dbconfig/src/main/resources/CannedSampleDBConfig.xml b/das-java/trunk/samples/dbconfig/src/main/resources/CannedSampleDBConfig.xml new file mode 100644 index 0000000000..2b7b1ba1fd --- /dev/null +++ b/das-java/trunk/samples/dbconfig/src/main/resources/CannedSampleDBConfig.xml @@ -0,0 +1,47 @@ + + + + + + + + 'ACME Publishing' + 'Do-rite plumbing' + 'MegaCorp' +
+ + 'Advanced Technologies', 'NY', '123', 1 + 'Default Name', '', '', 51 + 'Default Name', '', '', 51 + 'Default Name', '', '', 51 + 'Default Name', '', '', 51 + 'Default Name', '', '', 51 + 'Default Name', '', '', 51 +
+ + 'John Jones','E0001',0,12 + 'Mary Smith','E0002',1,null + 'Jane Doe','E0003',0,12 + 'Al Smith','E0004',1,12 +
+
diff --git a/das-java/trunk/samples/dbconfig/src/main/resources/DBConfig.xsd b/das-java/trunk/samples/dbconfig/src/main/resources/DBConfig.xsd new file mode 100644 index 0000000000..798c88c75c --- /dev/null +++ b/das-java/trunk/samples/dbconfig/src/main/resources/DBConfig.xsd @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/das-java/trunk/samples/dbconfig/src/main/resources/META-INF/LICENSE b/das-java/trunk/samples/dbconfig/src/main/resources/META-INF/LICENSE new file mode 100644 index 0000000000..fb4df3722c --- /dev/null +++ b/das-java/trunk/samples/dbconfig/src/main/resources/META-INF/LICENSE @@ -0,0 +1,353 @@ + + 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. + +=============================================================================================================== + +Other components and dependencies under Apache Software License 2.0 : + + log4j-1.2.14.jar - Apache Logging Services + derby 10.2.2.0.jar - Apache Derby + stax-api-1.0.1.jar - The Streaming API for XML (StAX) + wstx-asl-3.2.0.jar - WoodStox StAX implementation + standard-1.1.1.jar - The Apache Jackarta Taglibs + jstl-1.1.2.jar - The Apache Jackarta Taglibs + *.tld - The Apache Jackarta Taglibs + +=============================================================================================================== + + +Apache Tuscany SDO for Java Subcomponents +=========================================: + +The Tuscany SDO for Java release 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. + +License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar) + +Permission to copy, make derivative works of, and distribute the Service Data Objects +JavaDoc and Interface Definition Files files in any medium without fee or royalty as part +of a compliant implementation of the Service Data Objects Specification is hereby granted. +The Service Data Objects Specification may be found at any of the following locations: + +http://dev2dev.bea.com/technologies/commonj/index.jsp +http://www.ibm.com/developerworks/library/specification/ws-sdo/ +http://oracle.com/technology/webservices/sca +https://www.sdn.sap.com/ +http://www.xcalia/xdn/specs/sdo + +THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES +ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS +SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS, +INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE +SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES. + +The name and trademarks of the Authors may NOT be used in any manner, including advertising or +publicity pertaining to the Service Component Architecture Specification or its contents without specific, +written prior permission. Title to copyright in the Service Data Objects Specification and the +JavaDoc and Interface Definition Files will at all times remain with the Authors. + +No other rights are granted by implication, estoppel or otherwise. + +================================================================================================================= + +For the Eclipse EMF components +(codegen-2.2.3.jar +codegen-ecore-2.2.3.jar +common-2.2.3.jar +ecore-2.2.3.jar +ecore-change-2.2.3.jar +ecore-xmi-2.2.3.jar +xsd-2.2.3.jar) + +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. + +=================================================================================================== diff --git a/das-java/trunk/samples/dbconfig/src/main/resources/META-INF/NOTICE b/das-java/trunk/samples/dbconfig/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..c2cf1f95b4 --- /dev/null +++ b/das-java/trunk/samples/dbconfig/src/main/resources/META-INF/NOTICE @@ -0,0 +1,32 @@ +Apache Tuscany SDO for Java +Copyright 2006, 2007 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF), +sponsored by the Apache 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. + +Unless otherwise indicated, all distribution made available by the Apache Software Foundation +is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL"). +A copy of the AL is provided with this distribution as the LICENSE.txt file present in the +root directory, and is also available at http://www.apache.org/licenses/. + +The terms and conditions governing the distribution may refer to the AL or other license +agreements, notices or terms and conditions. Some of these other license agreements may +include (but are not limited to): + + . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html) + +It is your obligation to read and accept all such terms and conditions prior to use of the +distribution. If term or condition is provided, please contact the Apache Software Foundation +to determine what terms and conditions govern that particular distribution. + +This product also includes software developed by the Open Service Oriented Architecture organisation +(http://osoa.org). The license for this software may be found in the LICENSE.txt file contained in this +distribution. diff --git a/das-java/trunk/samples/dbconfig/src/main/resources/META-INF/README b/das-java/trunk/samples/dbconfig/src/main/resources/META-INF/README new file mode 100644 index 0000000000..723f3fd3ab --- /dev/null +++ b/das-java/trunk/samples/dbconfig/src/main/resources/META-INF/README @@ -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/das-java/trunk/samples/dbconfig/src/main/resources/log4j.properties b/das-java/trunk/samples/dbconfig/src/main/resources/log4j.properties new file mode 100644 index 0000000000..3b0e5074da --- /dev/null +++ b/das-java/trunk/samples/dbconfig/src/main/resources/log4j.properties @@ -0,0 +1,33 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# +# Set root logger level to DEBUG and its only appender to A1. + +log4j.rootLogger=NONE, NULL + +# NULL Appender +log4j.appender.NULL=org.apache.log4j.varia.NullAppender + +log4j.appender.NULL.layout=org.apache.log4j.PatternLayout +log4j.appender.NULL.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n + +# CONSOLE is set to be a ConsoleAppender. +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout + +# Print only messages of level WARN or above in the package com.foo. +log4j.logger.org.apache.tuscany=NONE \ No newline at end of file diff --git a/das-java/trunk/samples/dbconfig/src/test/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializerTestCase.java b/das-java/trunk/samples/dbconfig/src/test/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializerTestCase.java new file mode 100644 index 0000000000..3bd0bae407 --- /dev/null +++ b/das-java/trunk/samples/dbconfig/src/test/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializerTestCase.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dbconfig; + +import junit.framework.TestCase; + + + +/** + * Tests the Converter framwork + */ +public class DBInitializerTestCase extends TestCase { + + protected void setUp() throws Exception { + super.setUp(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + + public void testCreateDatabase() throws Exception { + DBInitializer dbInitializer = new DBInitializer("dbConfig.xml"); + dbInitializer.initializeDatabase(true); + } + + public void something() throws Exception { +// try{ +// //DBInitHelper dbInit = new DBInitHelper("DBConfig.xml"); +// DBInitializer dbInit = new DBInitializer(new FileInputStream("c:/DBConfig.xml")); +// dbInit.initializeDatabase(true); +// +// System.out.println("check schema created:"+dbInit.isDatabaseReady()); +// System.out.println("check data created:"+dbInit.isDataCreated()); +// +// dbInit.deleteData(); +// System.out.println("check data created after deleteData:"+dbInit.isDataCreated()); +// +// dbInit.deleteSchema(); +// System.out.println("after deleteSchema check schema created:"+dbInit.isDatabaseReady()); +// +// dbInit.createSchema(false); +// System.out.println("check schema created after createSchema:"+dbInit.isDatabaseReady()); +// +// dbInit.refreshData(true); +// System.out.println("check data created after refreshData:"+dbInit.isDataCreated()); +// }catch(Exception e){ +// e.printStackTrace(); +// } + } +} diff --git a/das-java/trunk/samples/dbconfig/src/test/resources/dbConfig.xml b/das-java/trunk/samples/dbconfig/src/test/resources/dbConfig.xml new file mode 100644 index 0000000000..51cb1c11d7 --- /dev/null +++ b/das-java/trunk/samples/dbconfig/src/test/resources/dbConfig.xml @@ -0,0 +1,52 @@ + + + + + + + + 51, 'ACME Publishing', 0 + 52, 'Do-rite plumbing', 0 + 53, 'MegaCorp', 0 +
+ + 'Advanced Technologies', 'NY', '123', 1 + 'Default Name', '', '', 51 + 'Default Name', '', '', 51 + 'Default Name', '', '', 51 + 'Default Name', '', '', 51 + 'Default Name', '', '', 51 + 'Default Name', '', '', 51 +
+ + 'John Jones','E0001',0,12 + 'Mary Smith','E0002',1,null + 'Jane Doe','E0003',0,12 + 'Al Smith','E0004',1,12 +
+ +
+ +
+
diff --git a/das-java/trunk/samples/pom.xml b/das-java/trunk/samples/pom.xml new file mode 100644 index 0000000000..b95b8f9653 --- /dev/null +++ b/das-java/trunk/samples/pom.xml @@ -0,0 +1,40 @@ + + + + 4.0.0 + + org.apache.tuscany.das + tuscany-das + 1.0-SNAPSHOT + + + org.apache.tuscany.das.samples + tuscany-das-samples + pom + Tuscany DAS Samples + + + dbconfig + company-webapp + advanced-webapp + customer + transaction + + diff --git a/das-java/trunk/samples/testing/tomcat/advanced-webapp/pom.xml b/das-java/trunk/samples/testing/tomcat/advanced-webapp/pom.xml new file mode 100644 index 0000000000..4f54e1d820 --- /dev/null +++ b/das-java/trunk/samples/testing/tomcat/advanced-webapp/pom.xml @@ -0,0 +1,80 @@ + + + + 4.0.0 + + org.apache.tuscany.das.samples + tuscany-das-samples-testing-tomcat + 1.0-SNAPSHOT + + + tuscany-das-samples-testing-tomcat-advanced-webapp + jar + Tuscany Testing Ajax DAS Web Sample + Testing Tomcat Ajax DAS end user test + + + + + junit + junit + 3.8.1 + test + + + htmlunit + htmlunit + 1.9 + test + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + jakarta-regexp + jakarta-regexp + 1.4 + + + ant + ant-jakarta-regexp + 1.6.1 + + + ant + ant-xslp + 1.6.5 + + + ant + ant-trax + 1.6.5 + + + + + + diff --git a/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/LICENSE b/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/LICENSE new file mode 100644 index 0000000000..fb4df3722c --- /dev/null +++ b/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/LICENSE @@ -0,0 +1,353 @@ + + 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. + +=============================================================================================================== + +Other components and dependencies under Apache Software License 2.0 : + + log4j-1.2.14.jar - Apache Logging Services + derby 10.2.2.0.jar - Apache Derby + stax-api-1.0.1.jar - The Streaming API for XML (StAX) + wstx-asl-3.2.0.jar - WoodStox StAX implementation + standard-1.1.1.jar - The Apache Jackarta Taglibs + jstl-1.1.2.jar - The Apache Jackarta Taglibs + *.tld - The Apache Jackarta Taglibs + +=============================================================================================================== + + +Apache Tuscany SDO for Java Subcomponents +=========================================: + +The Tuscany SDO for Java release 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. + +License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar) + +Permission to copy, make derivative works of, and distribute the Service Data Objects +JavaDoc and Interface Definition Files files in any medium without fee or royalty as part +of a compliant implementation of the Service Data Objects Specification is hereby granted. +The Service Data Objects Specification may be found at any of the following locations: + +http://dev2dev.bea.com/technologies/commonj/index.jsp +http://www.ibm.com/developerworks/library/specification/ws-sdo/ +http://oracle.com/technology/webservices/sca +https://www.sdn.sap.com/ +http://www.xcalia/xdn/specs/sdo + +THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES +ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS +SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS, +INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE +SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES. + +The name and trademarks of the Authors may NOT be used in any manner, including advertising or +publicity pertaining to the Service Component Architecture Specification or its contents without specific, +written prior permission. Title to copyright in the Service Data Objects Specification and the +JavaDoc and Interface Definition Files will at all times remain with the Authors. + +No other rights are granted by implication, estoppel or otherwise. + +================================================================================================================= + +For the Eclipse EMF components +(codegen-2.2.3.jar +codegen-ecore-2.2.3.jar +common-2.2.3.jar +ecore-2.2.3.jar +ecore-change-2.2.3.jar +ecore-xmi-2.2.3.jar +xsd-2.2.3.jar) + +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. + +=================================================================================================== diff --git a/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/NOTICE b/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..c2cf1f95b4 --- /dev/null +++ b/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/NOTICE @@ -0,0 +1,32 @@ +Apache Tuscany SDO for Java +Copyright 2006, 2007 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF), +sponsored by the Apache 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. + +Unless otherwise indicated, all distribution made available by the Apache Software Foundation +is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL"). +A copy of the AL is provided with this distribution as the LICENSE.txt file present in the +root directory, and is also available at http://www.apache.org/licenses/. + +The terms and conditions governing the distribution may refer to the AL or other license +agreements, notices or terms and conditions. Some of these other license agreements may +include (but are not limited to): + + . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html) + +It is your obligation to read and accept all such terms and conditions prior to use of the +distribution. If term or condition is provided, please contact the Apache Software Foundation +to determine what terms and conditions govern that particular distribution. + +This product also includes software developed by the Open Service Oriented Architecture organisation +(http://osoa.org). The license for this software may be found in the LICENSE.txt file contained in this +distribution. diff --git a/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/README b/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/README new file mode 100644 index 0000000000..723f3fd3ab --- /dev/null +++ b/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/README @@ -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/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/test/java/org/apache/tuscany/test/das/AjaxDasTestCase.java b/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/test/java/org/apache/tuscany/test/das/AjaxDasTestCase.java new file mode 100644 index 0000000000..1335b4c484 --- /dev/null +++ b/das-java/trunk/samples/testing/tomcat/advanced-webapp/src/test/java/org/apache/tuscany/test/das/AjaxDasTestCase.java @@ -0,0 +1,596 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.test.das; + +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + + +import junit.framework.TestCase; + +import com.gargoylesoftware.htmlunit.BrowserVersion; +import com.gargoylesoftware.htmlunit.CollectingAlertHandler; +import com.gargoylesoftware.htmlunit.WebClient; +import com.gargoylesoftware.htmlunit.html.FrameWindow; +import com.gargoylesoftware.htmlunit.html.HtmlAnchor; +import com.gargoylesoftware.htmlunit.html.HtmlButtonInput; +import com.gargoylesoftware.htmlunit.html.HtmlForm; +import com.gargoylesoftware.htmlunit.html.HtmlOption; +import com.gargoylesoftware.htmlunit.html.HtmlPage; +import com.gargoylesoftware.htmlunit.html.HtmlRadioButtonInput; +import com.gargoylesoftware.htmlunit.html.HtmlSelect; + +public class AjaxDasTestCase extends TestCase { + public static final String testUrl = "http://localhost:8080/sample-advanced-webapp"; + + protected WebClient _webClient; + protected URL _url; + final List collectedAlerts = new ArrayList(); + + protected void setUp() throws Exception { + //New HTMLunit web client + _webClient = new WebClient(BrowserVersion.MOZILLA_1_0); + //System.out.println("SETTING ALERT HANDLER"); + _webClient.setAlertHandler( new CollectingAlertHandler(collectedAlerts) ); + _webClient.setRedirectEnabled(true); + // Going to have the WebClient connect to this URL + _url = new URL(testUrl); + } + + public void testHomepage() throws Exception { + final String TEST_CASE = "AjaxDASHomePage"; + System.out.print("Running:" + TEST_CASE + "\t\t\t"); + //System.out.println("js enabled?"+_webClient.isJavaScriptEnabled()); + final HtmlPage page = (HtmlPage) _webClient.getPage(_url); + //System.out.println("page title:"+page.getTitleText()); + String responseText = page.asText(); + //System.out.println("page html-->\n" + responseText); + //check page header + assertTrue(-1 != responseText.indexOf("Tuscany DAS Web Sample")); + + FrameWindow menuFrame = page.getFrameByName("fixed"); + HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage(); + String menuResponseText = menuPage.asText(); + //System.out.println("menu html-->\n" + menuResponseText); + //check main menu and sub menu + assertTrue(-1 != menuResponseText.indexOf("Advanced Features")); + assertTrue(-1 != menuResponseText.indexOf("OCC")); + assertTrue(-1 != menuResponseText.indexOf("Converter")); + assertTrue(-1 != menuResponseText.indexOf("Result Set Shape")); + assertTrue(-1 != menuResponseText.indexOf("Adhoc Query")); + assertTrue(-1 != menuResponseText.indexOf("Command")); + + collectedAlerts.clear(); + System.out.println("SUCCESS!!!"); + } + + public void testDBRefresh() throws Exception{ + final String TEST_CASE = "DBRefresh"; + System.out.print("Running:" + TEST_CASE + "\t\t"); + + final HtmlPage page = (HtmlPage) _webClient.getPage(_url); + FrameWindow menuFrame = page.getFrameByName("fixed"); + HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage(); + HtmlButtonInput commandButton = (HtmlButtonInput)menuPage.getFormByName("MenuForm").getHtmlElementById("refreshButton"); + HtmlPage commandResult = null; + if(commandButton != null){ + //System.out.println("command button text:"+commandButton.asText()); + commandButton.focus(); + //System.out.println("command button script:"+commandButton.getOnClickAttribute()); + commandResult = (HtmlPage)commandButton.click(); + } + + //System.out.println("alerts size:"+collectedAlerts.size()); + //if(collectedAlerts.size() > 0){ + //for(int i=0; i\n"+commandResultText); + + while(commandResultText.indexOf("Refreshed database!") == -1){ + Thread.sleep(1000); + commandResultText = commandResult.asText(); + //System.out.println("commandResultText-->\n" + commandResultText); + } + assertTrue(-1 != commandResultText.indexOf("Refreshed database!")); + + collectedAlerts.clear(); + System.out.println("SUCCESS!!!"); + } + + public void testAllCompanies_Adhoc() throws Exception{ + final String TEST_CASE = "AllCompanies_Adhoc"; + System.out.print("Running:" + TEST_CASE + "\t\t\t"); + + final HtmlPage page = (HtmlPage) _webClient.getPage(_url); + FrameWindow menuFrame = page.getFrameByName("fixed"); + HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage(); + + //basic content + HtmlAnchor adhocAnchor = menuPage.getAnchorByHref("./indexAdhoc.jsp"); + HtmlPage adhocPage = (HtmlPage)adhocAnchor.click(); + String adhocText = adhocPage.asText(); + //System.out.println("adhoc html-->\n" + adhocText); + assertTrue(-1 != adhocText.indexOf("Adhoc SQL Query"));//heading + assertTrue(-1 != adhocText.indexOf("ExecuteQuery"));//button text + + //list values + HtmlForm adhocForm = adhocPage.getFormByName("DasForm"); + //adhocPage.getEnclosingWindow().getWebClient() + HtmlSelect adhocList = (HtmlSelect)adhocForm.getHtmlElementById("sqlQuery"); + List adhocListOptions = adhocList.getOptions();//.asText(); + //System.out.println(" adhocListOptionsText-->\n" + adhocListOptions.toString()); + String allOptionsText = ""; + for(int i=0; i1"));//check each option + assertTrue(-1 != allOptionsText.indexOf("UPDATE DEPARTMENT SET NAME='MyUpdDept' WHERE COMPANYID=1 AND ID=1"));//check each option + + //check result + HtmlButtonInput adhocButton = (HtmlButtonInput)adhocForm.getHtmlElementById("queryButton"); + adhocButton.focus(); + HtmlPage adhocResult = (HtmlPage)adhocButton.click(); + String adhocResultText = adhocResult.asText(); + //System.out.println("initial result:"+adhocResultText); + + //System.out.println("alerts size:"+collectedAlerts.size()); + //if(collectedAlerts.size() > 0){ + // for(int i=0; i\n" + commandText); + assertTrue(-1 != commandText.indexOf("DAS Command:"));//heading + assertTrue(-1 != commandText.indexOf("ExecuteCommand"));//button text + + //list values + HtmlForm commandForm = commandPage.getFormByName("DasForm"); + HtmlSelect commandList = (HtmlSelect)commandForm.getHtmlElementById("DasCommand"); + List commandListOptions = commandList.getOptions(); + //System.out.println(" commandListOptionsText-->\n" + commandListOptions.toString()); + String allOptionsText = ""; + for(int i=0; i 0){ + //for(int i=0; i\n"+commandResultText); + + while(commandResultText.indexOf("das:DataGraphRoot") == -1){ + Thread.sleep(1000); + commandResultText = commandResult.asText(); + } + //System.out.println("commandResultText-->\n" + commandResultText); + + assertTrue(-1 != commandResultText.indexOf("ACME Publishing")); + assertTrue(-1 != commandResultText.indexOf("Do-rite plumbing")); + assertTrue(-1 != commandResultText.indexOf("MegaCorp")); + assertTrue(-1 != commandResultText.indexOf("Advanced Technologies")); + assertTrue(-1 != commandResultText.indexOf("COMPANYID")); + assertTrue(-1 != commandResultText.indexOf("1")); + + collectedAlerts.clear(); + System.out.println("SUCCESS!!!"); + } + + public void testInsertCompanies_Adhoc() throws Exception{ + final String TEST_CASE = "InsertCompanies_Adhoc"; + System.out.print("Running:" + TEST_CASE + "\t\t\t"); + + final HtmlPage page = (HtmlPage) _webClient.getPage(_url); + FrameWindow menuFrame = page.getFrameByName("fixed"); + HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage(); + + //basic content + HtmlAnchor adhocAnchor = menuPage.getAnchorByHref("./indexAdhoc.jsp"); + HtmlPage adhocPage = (HtmlPage)adhocAnchor.click(); + String adhocText = adhocPage.asText(); + //System.out.println("adhoc html-->\n" + adhocText); + assertTrue(-1 != adhocText.indexOf("Adhoc SQL Query"));//heading + assertTrue(-1 != adhocText.indexOf("ExecuteQuery"));//button text + + //list values + HtmlForm adhocForm = adhocPage.getFormByName("DasForm"); + //adhocPage.getEnclosingWindow().getWebClient() + HtmlSelect adhocList = (HtmlSelect)adhocForm.getHtmlElementById("sqlQuery"); + List adhocListOptions = adhocList.getOptions();//.asText(); + //System.out.println(" adhocListOptionsText-->\n" + adhocListOptions.toString()); + String allOptionsText = ""; + for(int i=0; i1"));//check each option + assertTrue(-1 != allOptionsText.indexOf("UPDATE DEPARTMENT SET NAME='MyUpdDept' WHERE COMPANYID=1 AND ID=1"));//check each option + + //check result + HtmlButtonInput adhocButton = (HtmlButtonInput)adhocForm.getHtmlElementById("queryButton"); + HtmlPage adhocResult = (HtmlPage)adhocButton.click(); + + //System.out.println("alerts size:"+collectedAlerts.size()); + //if(collectedAlerts.size() > 0){ + //for(int i=0; i\n" + adhocResultText); + } + + assertTrue(-1 != adhocResultText.indexOf("ACME Publishing")); + assertTrue(-1 != adhocResultText.indexOf("Do-rite plumbing")); + assertTrue(-1 != adhocResultText.indexOf("MegaCorp")); + assertTrue(-1 != adhocResultText.indexOf("Advanced Technologies")); + assertTrue(-1 != adhocResultText.indexOf("COMPANYID")); + assertTrue(-1 != adhocResultText.indexOf("1")); + assertTrue(-1 != adhocResultText.indexOf("MyDept")); + assertTrue(adhocResultText.indexOf("COMPANYID") != adhocResultText.lastIndexOf("COMPANYID")); + + collectedAlerts.clear(); + System.out.println("SUCCESS!!!"); + } + + public void testDeleteDepartment_Command() throws Exception{ + final String TEST_CASE = "DeleteDepartment_Command"; + System.out.print("Running:" + TEST_CASE + "\t\t"); + + final HtmlPage page = (HtmlPage) _webClient.getPage(_url); + FrameWindow menuFrame = page.getFrameByName("fixed"); + HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage(); + + //basic content + HtmlAnchor commandAnchor = menuPage.getAnchorByHref("./indexCommand.jsp"); + HtmlPage commandPage = (HtmlPage)commandAnchor.click(); + String commandText = commandPage.asText(); + //System.out.println("command html-->\n" + commandText); + assertTrue(-1 != commandText.indexOf("DAS Command:"));//heading + assertTrue(-1 != commandText.indexOf("ExecuteCommand"));//button text + + //list values + HtmlForm commandForm = commandPage.getFormByName("DasForm"); + HtmlSelect commandList = (HtmlSelect)commandForm.getHtmlElementById("DasCommand"); + List commandListOptions = commandList.getOptions(); + //System.out.println(" commandListOptionsText-->\n" + commandListOptions.toString()); + String allOptionsText = ""; + for(int i=0; i 0){ + //for(int i=0; i\n"+commandResultText); + + while(commandResultText.indexOf("das:DataGraphRoot") == -1){ + Thread.sleep(1000); + commandResultText = commandResult.asText(); + //System.out.println("commandResultText-->\n" + commandResultText); + } + + assertTrue(-1 != commandResultText.indexOf("ACME Publishing")); + assertTrue(-1 != commandResultText.indexOf("Do-rite plumbing")); + assertTrue(-1 != commandResultText.indexOf("MegaCorp")); + assertTrue(-1 != commandResultText.indexOf("Advanced Technologies")); + assertTrue(-1 != commandResultText.indexOf("COMPANYID")); + assertTrue(-1 != commandResultText.indexOf("1")); + + collectedAlerts.clear(); + System.out.println("SUCCESS!!!"); + } + + public void testOCC() throws Exception{ + final String TEST_CASE = "OCC"; + System.out.print("Running:" + TEST_CASE + "\t\t"); + + final HtmlPage page = (HtmlPage) _webClient.getPage(_url); + FrameWindow menuFrame = page.getFrameByName("fixed"); + HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage(); + + //basic content + HtmlAnchor commandAnchor = menuPage.getAnchorByHref("./occ.jsp"); + HtmlPage commandPage = (HtmlPage)commandAnchor.click(); + String commandText = commandPage.asText(); + //System.out.println("command html-->\n" + commandText); + assertTrue(-1 != commandText.indexOf("Automatic Optimistic Concurrency Control:"));//heading + assertTrue(-1 != commandText.indexOf("ExecuteTransaction"));//button text + + //list values + HtmlForm commandForm = commandPage.getFormByName("DasForm"); + //check result + HtmlButtonInput commandButton = (HtmlButtonInput)commandForm.getHtmlElementById("occButton"); + HtmlPage commandResult = null; + if(commandButton != null){ + //System.out.println("command button text:"+commandButton.asText()); + commandButton.focus(); + //System.out.println("command button script:"+commandButton.getOnClickAttribute()); + commandResult = (HtmlPage)commandButton.click(); + } + + //System.out.println("alerts size:"+collectedAlerts.size()); + //if(collectedAlerts.size() > 0){ + //for(int i=0; i\n"+commandResultText); + + while(commandResultText.indexOf("collision") == -1){ + Thread.sleep(1000); + commandResultText = commandResult.asText(); + //System.out.println("commandResultText-->\n" + commandResultText); + } + + assertTrue(-1 != commandResultText.indexOf("An update collision occurred")); + + collectedAlerts.clear(); + System.out.println("SUCCESS!!!"); + } + + public void testRSS() throws Exception{ + final String TEST_CASE = "RSS"; + System.out.print("Running:" + TEST_CASE + "\t\t"); + + final HtmlPage page = (HtmlPage) _webClient.getPage(_url); + FrameWindow menuFrame = page.getFrameByName("fixed"); + HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage(); + + //basic content + HtmlAnchor commandAnchor = menuPage.getAnchorByHref("./rss.jsp"); + HtmlPage commandPage = (HtmlPage)commandAnchor.click(); + String commandText = commandPage.asText(); + //System.out.println("command html-->\n" + commandText); + assertTrue(-1 != commandText.indexOf("Result Set Shape:"));//heading + assertTrue(-1 != commandText.indexOf("ExecuteQuery"));//button text + + //list values + HtmlForm commandForm = commandPage.getFormByName("DasForm"); + //check result + HtmlButtonInput commandButton = (HtmlButtonInput)commandForm.getHtmlElementById("rssButton"); + HtmlPage commandResult = null; + if(commandButton != null){ + //System.out.println("command button text:"+commandButton.asText()); + commandButton.focus(); + //System.out.println("command button script:"+commandButton.getOnClickAttribute()); + commandResult = (HtmlPage)commandButton.click(); + } + + //System.out.println("alerts size:"+collectedAlerts.size()); + //if(collectedAlerts.size() > 0){ + //for(int i=0; i\n"+commandResultText); + + while(commandResultText.indexOf("das:DataGraphRoot") == -1){ + Thread.sleep(1000); + commandResultText = commandResult.asText(); + } + + //System.out.println("commandResultText-->\n" + commandResultText); + + assertTrue(-1 != commandResultText.indexOf("Roosevelt")); + assertTrue(-1 != commandResultText.indexOf("1600 Pennsylvania Avenue")); + + collectedAlerts.clear(); + System.out.println("SUCCESS!!!"); + } + + public void testConverter() throws Exception{ + final String TEST_CASE = "Converter"; + System.out.print("Running:" + TEST_CASE + "\t\t"); + + final HtmlPage page = (HtmlPage) _webClient.getPage(_url); + FrameWindow menuFrame = page.getFrameByName("fixed"); + HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage(); + + //basic content + HtmlAnchor commandAnchor = menuPage.getAnchorByHref("./converter.jsp"); + HtmlPage commandPage = (HtmlPage)commandAnchor.click(); + String commandText = commandPage.asText(); + //System.out.println("command html-->\n" + commandText); + assertTrue(-1 != commandText.indexOf("Arbitrary Converter:"));//heading + assertTrue(-1 != commandText.indexOf("ExecuteTransaction"));//button text + + //list values + HtmlForm commandForm = commandPage.getFormByName("DasForm"); + //select first radio buttom + HtmlRadioButtonInput stmt0 = (HtmlRadioButtonInput)commandForm.getRadioButtonInput("stmt", "stmt0"); + if(stmt0 != null){ + //System.out.println("got stmt0"); + stmt0.setChecked(true); + } + + //check result + HtmlButtonInput commandButton = (HtmlButtonInput)commandForm.getHtmlElementById("converterButton"); + HtmlPage commandResult = null; + if(commandButton != null){ + //System.out.println("command button text:"+commandButton.asText()); + commandButton.focus(); + //System.out.println("command button script:"+commandButton.getOnClickAttribute()); + commandResult = (HtmlPage)commandButton.click(); + } + + //System.out.println("alerts size:"+collectedAlerts.size()); + //if(collectedAlerts.size() > 0){ + //for(int i=0; i\n"+commandResultText); + + while(commandResultText.indexOf("das:DataGraphRoot") == -1){ + Thread.sleep(1000); + commandResultText = commandResult.asText(); + //System.out.println("commandResultText-->\n" + commandResultText); + } + assertTrue(-1 != commandResultText.indexOf("1957")); + + collectedAlerts.clear(); + System.out.println("SUCCESS!!!"); + } + + /** + * @param args + */ + public static void main(String[] args) throws Exception{ + AjaxDasTestCase t = new AjaxDasTestCase(); + t.setUp(); + try{ + ////t.testHomepage(); + //t.testAllCompanies_Adhoc(); + //t.testAllCompaniesDepartments_Command(); + //t.testInsertCompanies_Adhoc(); + //t.testDeleteDepartment_Command(); + //t.testOCC(); + ////t.testRSS(); + //t.testConverter(); + }catch(Exception e){ + e.printStackTrace(); + } + + } + +} diff --git a/das-java/trunk/samples/testing/tomcat/build.xml b/das-java/trunk/samples/testing/tomcat/build.xml new file mode 100644 index 0000000000..3f38968476 --- /dev/null +++ b/das-java/trunk/samples/testing/tomcat/build.xml @@ -0,0 +1,309 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/das-java/trunk/samples/testing/tomcat/company-webapp/pom.xml b/das-java/trunk/samples/testing/tomcat/company-webapp/pom.xml new file mode 100644 index 0000000000..cb4ad55a52 --- /dev/null +++ b/das-java/trunk/samples/testing/tomcat/company-webapp/pom.xml @@ -0,0 +1,80 @@ + + + + 4.0.0 + + org.apache.tuscany.das.samples + tuscany-das-samples-testing-tomcat + 1.0-SNAPSHOT + + + tuscany-das-samples-testing-tomcat-company-webapp + jar + Tuscany Testing DAS Sample - Company-webapp + Testing Tomcat DAS end user test + + + + + junit + junit + 3.8.1 + test + + + htmlunit + htmlunit + 1.9 + test + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + jakarta-regexp + jakarta-regexp + 1.4 + + + ant + ant-jakarta-regexp + 1.6.1 + + + ant + ant-xslp + 1.6.5 + + + ant + ant-trax + 1.6.5 + + + + + + diff --git a/das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/LICENSE b/das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/LICENSE new file mode 100644 index 0000000000..9597d92eb3 --- /dev/null +++ b/das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/LICENSE @@ -0,0 +1,353 @@ + + 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. + +=============================================================================================================== + +Other components and dependencies under Apache Software License 2.0 : + + log4j-1.2.14.jar - Apache Logging Services + derby 10.2.2.0.jar - Apache Derby + stax-api-1.0.1.jar - The Streaming API for XML (StAX) + wstx-asl-3.2.0.jar - WoodStox StAX implementation + standard-1.1.1.jar - The Apache Jackarta Taglibs + jstl-1.1.2.jar - The Apache Jackarta Taglibs + *.tld - The Apache Jackarta Taglibs + +=============================================================================================================== + + +Apache Tuscany SDO for Java Subcomponents +=========================================: + +The Tuscany SDO for Java release 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. + +License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar) + +Permission to copy, make derivative works of, and distribute the Service Data Objects +JavaDoc and Interface Definition Files files in any medium without fee or royalty as part +of a compliant implementation of the Service Data Objects Specification is hereby granted. +The Service Data Objects Specification may be found at any of the following locations: + +http://dev2dev.bea.com/technologies/commonj/index.jsp +http://www.ibm.com/developerworks/library/specification/ws-sdo/ +http://oracle.com/technology/webservices/sca +https://www.sdn.sap.com/ +http://www.xcalia/xdn/specs/sdo + +THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES +ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS +SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS, +INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE +SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES. + +The name and trademarks of the Authors may NOT be used in any manner, including advertising or +publicity pertaining to the Service Component Architecture Specification or its contents without specific, +written prior permission. Title to copyright in the Service Data Objects Specification and the +JavaDoc and Interface Definition Files will at all times remain with the Authors. + +No other rights are granted by implication, estoppel or otherwise. + +================================================================================================================= + +For the Eclipse EMF components +(codegen-2.2.3.jar +codegen-ecore-2.2.3.jar +common-2.2.3.jar +ecore-2.2.3.jar +ecore-change-2.2.3.jar +ecore-xmi-2.2.3.jar +xsd-2.2.3.jar) + +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. + +=================================================================================================== diff --git a/das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/NOTICE b/das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..e9d98fc7f5 --- /dev/null +++ b/das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/NOTICE @@ -0,0 +1,32 @@ +Apache Tuscany SDO for Java +Copyright 2006, 2007 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF), +sponsored by the Apache 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. + +Unless otherwise indicated, all distribution made available by the Apache Software Foundation +is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL"). +A copy of the AL is provided with this distribution as the LICENSE.txt file present in the +root directory, and is also available at http://www.apache.org/licenses/. + +The terms and conditions governing the distribution may refer to the AL or other license +agreements, notices or terms and conditions. Some of these other license agreements may +include (but are not limited to): + + . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html) + +It is your obligation to read and accept all such terms and conditions prior to use of the +distribution. If term or condition is provided, please contact the Apache Software Foundation +to determine what terms and conditions govern that particular distribution. + +This product also includes software developed by the Open Service Oriented Architecture organisation +(http://osoa.org). The license for this software may be found in the LICENSE.txt file contained in this +distribution. diff --git a/das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/README b/das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/README new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/das-java/trunk/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/README @@ -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/das-java/trunk/samples/testing/tomcat/company-webapp/src/test/java/org/apache/tuscany/test/das/DasTestCase.java b/das-java/trunk/samples/testing/tomcat/company-webapp/src/test/java/org/apache/tuscany/test/das/DasTestCase.java new file mode 100644 index 0000000000..faa92d6994 --- /dev/null +++ b/das-java/trunk/samples/testing/tomcat/company-webapp/src/test/java/org/apache/tuscany/test/das/DasTestCase.java @@ -0,0 +1,249 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.test.das; + +import java.net.URL; + +import junit.framework.TestCase; + +import com.gargoylesoftware.htmlunit.WebClient; +import com.gargoylesoftware.htmlunit.html.HtmlForm; +import com.gargoylesoftware.htmlunit.html.HtmlPage; +import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput; + +public class DasTestCase extends TestCase { + public static final String testUrl = "http://localhost:8080/sample-company-webapp/"; + + protected WebClient _webClient; + protected URL _url; + + protected void setUp() throws Exception { + //New HTMLunit web client + _webClient = new WebClient(); + _webClient.setRedirectEnabled(true); + + // Going to have the WebClient connect to this URL + _url = new URL(testUrl); + + } + + public void testHomepage() throws Exception { + final String TEST_CASE = "HomePage"; + System.out.print("Running:" + TEST_CASE + "\t\t\t"); + + final HtmlPage page = (HtmlPage) _webClient.getPage(_url); + //System.out.println(page.getTitleText()); + + String responseText = page.asText(); + //System.out.println("html-->\n" + responseText); + //check page header + assertTrue(-1 != responseText.indexOf("Tuscany DAS Companies WEB Example")); + //check table headers + assertTrue(-1 != responseText.indexOf("ID")); + assertTrue(-1 != responseText.indexOf("Name")); + assertTrue(-1 != responseText.indexOf("Department_ID")); + assertTrue(-1 != responseText.indexOf("Department_Name")); + //check companies values + //assertTrue(-1 != responseText.indexOf("51")); + assertTrue(-1 != responseText.indexOf("ACME Publishing")); + //assertTrue(-1 != responseText.indexOf("53")); + assertTrue(-1 != responseText.indexOf("Do-rite plumbing")); + //assertTrue(-1 != responseText.indexOf("53")); + assertTrue(-1 != responseText.indexOf("MegaCorp")); + //check departments + assertTrue(-1 != responseText.indexOf("Default Name 2")); + assertTrue(-1 != responseText.indexOf("Default Name 3")); + assertTrue(-1 != responseText.indexOf("Default Name 4")); + assertTrue(-1 != responseText.indexOf("Default Name 5")); + assertTrue(-1 != responseText.indexOf("Default Name 6")); + assertTrue(-1 != responseText.indexOf("Default Name 7")); + assertTrue(-1 != responseText.indexOf("Default Name 8")); + + System.out.println("SUCCESS!!!"); + } + + + public void testAllCompanies() throws Exception{ + final String TEST_CASE = "AllCompanies"; + System.out.print("Running:" + TEST_CASE + "\t\t\t"); + + // Get the first page + final HtmlPage page = (HtmlPage) _webClient.getPage(_url); + + // Get the form that we are dealing with and within that form, + // find the submit button and the field that we want to change. + final HtmlForm form = (HtmlForm) page.getForms().get(0); + final HtmlSubmitInput allCompaniesButton = (HtmlSubmitInput)form.getHtmlElementById("doFill"); + // Now submit the form by clicking the button + final HtmlPage resultPage = (HtmlPage)allCompaniesButton.click(); + + //verify the resultPage + String responseText = resultPage.asText(); + //System.out.println("html-->\n" + responseText); + // check table headers + assertTrue(-1 != responseText.indexOf("ID")); + assertTrue(-1 != responseText.indexOf("Name")); + //check table values + //assertTrue(-1 != responseText.indexOf("51")); + assertTrue(-1 != responseText.indexOf("ACME Publishing")); + //assertTrue(-1 != responseText.indexOf("52")); + assertTrue(-1 != responseText.indexOf("Do-rite plumbing")); + //assertTrue(-1 != responseText.indexOf("53")); + assertTrue(-1 != responseText.indexOf("MegaCorp")); + + System.out.println("SUCCESS!!!"); + } + + public void testAllCompaniesDepartments() throws Exception{ + final String TEST_CASE = "AllCompaniesDepartments"; + System.out.print("Running:" + TEST_CASE + "\t\t"); + + // Get the first page + final HtmlPage page = (HtmlPage) _webClient.getPage(_url); + + // Get the form that we are dealing with and within that form, + // find the submit button and the field that we want to change. + final HtmlForm form = (HtmlForm) page.getForms().get(0); + final HtmlSubmitInput allCompaniesButton = (HtmlSubmitInput)form.getHtmlElementById("doFillAll"); + // Now submit the form by clicking the button + final HtmlPage resultPage = (HtmlPage)allCompaniesButton.click(); + + //verify the resultPage + String responseText = resultPage.asText(); + //System.out.println("html-->\n" + responseText); + //check table headers + assertTrue(-1 != responseText.indexOf("ID")); + assertTrue(-1 != responseText.indexOf("Name")); + assertTrue(-1 != responseText.indexOf("Department_ID")); + assertTrue(-1 != responseText.indexOf("Department_Name")); + //check companies values + //assertTrue(-1 != responseText.indexOf("51")); + assertTrue(-1 != responseText.indexOf("ACME Publishing")); + //assertTrue(-1 != responseText.indexOf("53")); + assertTrue(-1 != responseText.indexOf("Do-rite plumbing")); + //assertTrue(-1 != responseText.indexOf("53")); + assertTrue(-1 != responseText.indexOf("MegaCorp")); + //check departments + assertTrue(-1 != responseText.indexOf("Default Name 2")); + assertTrue(-1 != responseText.indexOf("Default Name 3")); + assertTrue(-1 != responseText.indexOf("Default Name 4")); + assertTrue(-1 != responseText.indexOf("Default Name 5")); + assertTrue(-1 != responseText.indexOf("Default Name 6")); + assertTrue(-1 != responseText.indexOf("Default Name 7")); + assertTrue(-1 != responseText.indexOf("Default Name 8")); + + System.out.println("SUCCESS!!!"); + } + + public void testAddDepartmentToFirstCompany() throws Exception{ + final String TEST_CASE = "AddDepartmentToFirstCompany"; + System.out.print("Running:" + TEST_CASE + "\t"); + + // Get the first page + final HtmlPage page = (HtmlPage) _webClient.getPage(_url); + + // Get the form that we are dealing with and within that form, + // find the submit button and the field that we want to change. + final HtmlForm form = (HtmlForm) page.getForms().get(0); + final HtmlSubmitInput allCompaniesButton = (HtmlSubmitInput)form.getHtmlElementById("doAddDepartment"); + // Now submit the form by clicking the button + final HtmlPage resultPage = (HtmlPage)allCompaniesButton.click(); + + //verify the resultPage + String responseText = resultPage.asText(); + //System.out.println("html-->\n" + responseText); + //check new department + assertTrue(-1 != responseText.indexOf("8")); + + System.out.println("SUCCESS!!!"); + } + + public void testChangeCompanyDepartmentNames() throws Exception{ + final String TEST_CASE = "ChangeCompanyDepartmentNames"; + System.out.print("Running:" + TEST_CASE + "\t"); + + // Get the first page + final HtmlPage page = (HtmlPage) _webClient.getPage(_url); + + // Get the form that we are dealing with and within that form, + // find the submit button and the field that we want to change. + final HtmlForm form = (HtmlForm) page.getForms().get(0); + final HtmlSubmitInput allCompaniesButton = (HtmlSubmitInput)form.getHtmlElementById("doChangeDepartmentNames"); + // Now submit the form by clicking the button + final HtmlPage resultPage = (HtmlPage)allCompaniesButton.click(); + + //verify the resultPage + String responseText = resultPage.asText(); + //System.out.println("html-->\n" + responseText); + //check update departments + assertTrue(-1 != responseText.indexOf("Dept-")); + //also, check to not have old departments names (default name) + assertTrue(-1 == responseText.indexOf("Default Name")); + + System.out.println("SUCCESS!!!"); + } + + public void testDeleteCompanyOneDepartments() throws Exception{ + final String TEST_CASE = "DeleteCompanyOneDepartments"; + System.out.print("Running:" + TEST_CASE + "\t"); + + // Get the first page + final HtmlPage page = (HtmlPage) _webClient.getPage(_url); + + // Get the form that we are dealing with and within that form, + // find the submit button and the field that we want to change. + final HtmlForm form = (HtmlForm) page.getForms().get(0); + final HtmlSubmitInput allCompaniesButton = (HtmlSubmitInput)form.getHtmlElementById("doDeleteDepartments"); + // Now submit the form by clicking the button + final HtmlPage resultPage = (HtmlPage)allCompaniesButton.click(); + + //verify the resultPage + String responseText = resultPage.asText(); + //System.out.println("html-->\n" + responseText); + //check that al the company 1 departments are gone.. + assertTrue(-1 == responseText.indexOf("Default Name 2")); + assertTrue(-1 == responseText.indexOf("Default Name 3")); + assertTrue(-1 == responseText.indexOf("Default Name 4")); + assertTrue(-1 == responseText.indexOf("Default Name 5")); + assertTrue(-1 == responseText.indexOf("Default Name 6")); + assertTrue(-1 == responseText.indexOf("Default Name 7")); + assertTrue(-1 == responseText.indexOf("Default Name 8")); + + System.out.println("SUCCESS!!!"); + } + + /** + * @param args + */ + public static void main(String[] args) { + DasTestCase t = new DasTestCase(); + try{ + t.testHomepage(); + t.testAllCompanies(); + t.testAllCompaniesDepartments(); + t.testAddDepartmentToFirstCompany(); + t.testChangeCompanyDepartmentNames(); + t.testDeleteCompanyOneDepartments(); + }catch(Exception e){ + e.printStackTrace(); + } + + } + +} diff --git a/das-java/trunk/samples/testing/tomcat/context.xsl b/das-java/trunk/samples/testing/tomcat/context.xsl new file mode 100644 index 0000000000..35a78a43a5 --- /dev/null +++ b/das-java/trunk/samples/testing/tomcat/context.xsl @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + diff --git a/das-java/trunk/samples/testing/tomcat/datasource.xsl b/das-java/trunk/samples/testing/tomcat/datasource.xsl new file mode 100644 index 0000000000..ffd17f3271 --- /dev/null +++ b/das-java/trunk/samples/testing/tomcat/datasource.xsl @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + Global Datasource for Derby dastest database + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/das-java/trunk/samples/testing/tomcat/pom.xml b/das-java/trunk/samples/testing/tomcat/pom.xml new file mode 100644 index 0000000000..6ab37dccab --- /dev/null +++ b/das-java/trunk/samples/testing/tomcat/pom.xml @@ -0,0 +1,112 @@ + + + + 4.0.0 + + org.apache.tuscany.das.samples + tuscany-das-samples + 1.0-SNAPSHOT + + + tuscany-das-samples-testing-tomcat + pom + Tuscany Testing in Tomcat + + + company-webapp + advanced-webapp + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*TestCase.java + + + + + + + + src/test/java + + **/*.componentType + + + + src/test/resources + + **/* + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.1 + + + prepareTomcat + process-test-resources + + + + + + + + + + + + run + + + + + cleanupTomcat + clean + + + + + + + + + run + + + + + + + + + test + + diff --git a/das-java/trunk/samples/testing/tomcat/readme.htm b/das-java/trunk/samples/testing/tomcat/readme.htm new file mode 100644 index 0000000000..e7fd28a4ac --- /dev/null +++ b/das-java/trunk/samples/testing/tomcat/readme.htm @@ -0,0 +1,86 @@ + + + + Tuscany End User Sample Testing + + +

Tuscany End User Sample Testing

+

Initial Setup

  +   Most of the following only needs to be done once +unless noted otherwise.
+
    +
  • Be sure JAVA_HOME variable is pointing to a Java JDK directory.
  • +
  • Follow the steps to build Tuscany DAS Companyweb sample application from DAS Java Developer Guide.
  • + +
  • Change directory +to java/das/samples/testing/tomcat.
  • + +
  • Download +Tomcat Core 6.0.xx zip +for Windows or  tar.gz for Linux  from Apache +Tomcat.
  • + +
  • You can place the tomcat distribution in your java/samples/das/testing/tomcat directory or, alternatively, you can create/edit {user home}/build.properties to +change the property tuscany.acceptance.tomcat.zipped to tell the build +environment where the tomcat distribution zip file is located.
  • +
  • You may have to edit build.xml  to change the property tuscany.acceptance.tomcat.version +to match the xx +to the specific version that you downloaded.
  • +
+ +

 Running

In +the java/das/samples/testing/tomcat +directory run maven:
mvn

Explanation

Maven does +the following:
  • Unpacks the +Tomcat distribution into the target directory to ensure a pristine +environment.
  • It adds the appropriate Tuscany and it +dependencies jars into Tomcat (for more  details)
  • Does +the necessary changes +to Tomcat's configuration as required. (for more  details)
  • Deploys +Tuscany's DAS sample war files into Tomcat.
  • Starts +Tomcat (You should see another window running Tomcat) 
  • Begins +running HTML unit tests that should closely match running the samples +as a user would.
If all goes well at the end you +should see:
+
[INFO] ----------------------------------------------------------------------------
+[INFO] Reactor Summary:
+[INFO] ----------------------------------------------------------------------------
+[INFO] Tuscany Testing in Tomcat .............................. SUCCESS [0.961s]
+[INFO] Tuscany Testing Tomcat DAS Sample - Companyweb ......... SUCCESS [1:09.771s]
+[INFO] Tuscany Testing Ajax DAS Web Sample .................... SUCCESS [47.458s]
+[INFO] ----------------------------------------------------------------------------
+[INFO] ----------------------------------------------------------------------------
+[INFO] BUILD SUCCESSFUL
+[INFO] ---------------------------------------------------------------------------- +[INFO] Total time: 1 minute 59 seconds +[INFO] Finished at: Sun Jun 10 01:23:19 VET 2007 +[INFO] Final Memory: 9M/17M +[INFO] ----------------------------------------------------------------------------
+

Cleanup

Close +the Tomcat window and issue mvn clean.

Note

+

Because the html unit tests execute multiple user actions that change the contents of the database tables, is recommended +that you always run these tests in a clean environment (after a mvn clean), +otherwise you may experience failure on some tests as the expected result data might have been affected by previous test runs.

+ + \ No newline at end of file diff --git a/das-java/trunk/samples/testing/tomcat/server.xsl b/das-java/trunk/samples/testing/tomcat/server.xsl new file mode 100644 index 0000000000..b53d1d50c7 --- /dev/null +++ b/das-java/trunk/samples/testing/tomcat/server.xsl @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + org.apache.tuscany.tomcat.TuscanyHost + + + + + + + + diff --git a/das-java/trunk/samples/transaction/build.xml b/das-java/trunk/samples/transaction/build.xml new file mode 100644 index 0000000000..5289215be5 --- /dev/null +++ b/das-java/trunk/samples/transaction/build.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/das-java/trunk/samples/transaction/pom.xml b/das-java/trunk/samples/transaction/pom.xml new file mode 100644 index 0000000000..f6e50d779e --- /dev/null +++ b/das-java/trunk/samples/transaction/pom.xml @@ -0,0 +1,148 @@ + + + + 4.0.0 + + org.apache.tuscany.das.samples + tuscany-das-samples + 1.0-SNAPSHOT + + + tuscany-das-sample-transaction + jar + Tuscany DAS J2SE Transaction Sample Using Transaction Manager + Sample use of RDB DAS in a J2SE application with Transaction Manager + + + + org.apache.tuscany.das + tuscany-das-rdb + ${das.version} + compile + + + + org.apache.tuscany.sdo + tuscany-sdo-impl + ${sdo.version} + compile + + + + org.apache.tuscany.sdo + tuscany-sdo-api-r2.1 + ${sdo.version} + compile + + + + org.apache.tuscany.das.samples + tuscany-das-sample-dbconfig + ${das.version} + compile + + + org.apache.derby + derby + + + + + + mysql + mysql-connector-java + 5.0.4 + compile + + + + org.apache.geronimo.specs + geronimo-jta_1.1_spec + 1.1 + + + + org.apache.geronimo.components + geronimo-transaction + 2.0.1 + + + mx4j + mx4j + + + commons-jelly-tags-velocity + commons-jelly + + + velocity + velocity + + + geronimo-core + org.apache.geronimo.modules + + + geronimo-kernel + org.apache.geronimo.modules + + + geronimo-system + org.apache.geronimo.modules + + + geronimo-j2ee + org.apache.geronimo.modules + + + + + + + + + sample-transaction + src/main/java + + + src/main/java + + + src/main/resources + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + org.apache.tuscany.samples.das.tx.sample.MoneyTransfer + true + + + + + + + + + diff --git a/das-java/trunk/samples/transaction/readme.htm b/das-java/trunk/samples/transaction/readme.htm new file mode 100644 index 0000000000..6cf450d41a --- /dev/null +++ b/das-java/trunk/samples/transaction/readme.htm @@ -0,0 +1,449 @@ + + + + + + + + + +Tuscany RDB DAS Sample + + + + + + + + + + + +
+ +

RDB DAS Transaction Sample

+ +

 

+ +

Introduction

+ +

This stand-alone sample demonstrates the RDB Data Access Service +transaction management with external Transaction Manager. This example uses Geronimo + as the transaction manager.

+ +

 

+ +

Example

+ +

In this MoneyTransfer example,user entered amount will be withdrawn from +one of his bankaccount using one call to das.applyChanges(dataGraph1) and same +amount will  be deposited to his another +account using another call to das.applyChanges(dataGraph2). Based on whether +user selects commit/rollback, these 2 applyChanges() will behave identically. +i.e. both will commit or both will rollback, but partial transaction will not +happen. Example build.xml - sets for transfer of 1200 from Account1 to Account2 +[commit].

+ +

 

+ +

Building and Running

+ +

 From binary distribution, base +directory is {DAS_ROOT}\ samples\transaction. Refer to below settings from +this base directory.

+ +

1]BankAccounts.xml available in sample-transaction.jar, is the DAS +config file. Note that, as transaction is externally managed, this uses +managedtx=false setting.

+ +

 

+ +

2]MySQL server should be running. The example uses MySQL DB (with innoDB +ON to support transaction). Database dastest, table bankaccount and +data will be created during sample run. For this preconfigured +BankAccountDBConfig.xml available in sample-transaction.jar, will be used. User +needs to set correct values for url, login etc. in this.

+ +

 

+ +

3] Apache Ant latest version should be installed.Download Apache Ant +latest version on and extract into folder <apache_ant_folder>. You can +find it here: http://ant.apache.org/bindownload.cgi.Add +<apache_ant_folder>/bin directory to your OS path variable.

+ +

 

+ +

4] From base directory run-  +ant

+ +

 

+ +

The sample will run and output the following:

+ +
+ +

Buildfile: build.xml

+ +

 

+ +

run:

+ +

     [java] +INIT database

+ +

     [java] +INIT transaction manager

+ +

     [java] +Wed Sep 19 17:09:42 IST 2007 DEBUG: Executing XA statement: XA START

+ +

 0x01000000000000004bceb90109b6b0f3000000000000000000000000000000000000000000000

+ +

000000000000000000000000000000000000000000000000000,0x00000000000000000000000000

+ +

00000000000000000000000000000000000000000000000000000000000000000000000000000000

+ +

0000000000000000000000,0x4765526f

+ +

     [java] +Get a connection

+ +

     [java] +Before transaction, table is:

+ +

     [java]     id      +name    balance

+ +

     [java]     1       +John Feng       1200

+ +

     [java]     2       +John Feng       0

+ +

     [java] +Begin a transaction

+ +

     [java] +Update the table - 2 accounts

+ +

     [java] +*commit* the transaction

+ +

     [java] +Wed Sep 19 17:09:45 IST 2007 DEBUG: Executing XA statement: XA END 0

+ +

x01000000000000004bceb90109b6b0f300000000000000000000000000000000000000000000000

+ +

0000000000000000000000000000000000000000000000000,0x0000000000000000000000000000

+ +

00000000000000000000000000000000000000000000000000000000000000000000000000000000

+ +

00000000000000000000,0x4765526f

+ +

     [java] +Wed Sep 19 17:09:45 IST 2007 DEBUG: Executing XA statement: XA PREPA

+ +

RE 0x01000000000000004bceb90109b6b0f30000000000000000000000000000000000000000000

+ +

00000000000000000000000000000000000000000000000000000,0x000000000000000000000000

+ +

00000000000000000000000000000000000000000000000000000000000000000000000000000000

+ +

000000000000000000000000,0x4765526f

+ +

     [java] +Wed Sep 19 17:09:45 IST 2007 DEBUG: Executing XA statement: XA COMMI

+ +

T 0x01000000000000004bceb90109b6b0f300000000000000000000000000000000000000000000

+ +

0000000000000000000000000000000000000000000000000000,0x0000000000000000000000000

+ +

00000000000000000000000000000000000000000000000000000000000000000000000000000000

+ +

00000000000000000000000,0x4765526f

+ +

     [java] +After transaction, table is:

+ +

     [java]     id      +name    balance

+ +

     [java]     1       +John Feng       0

+ +

     [java]     2       +John Feng       1200

+ +

     [java] +Cleanup

+ +

     [java] +End MoneyTransfer

+ +

     [java]

+ +

 

+ +

BUILD SUCCESSFUL

+ +

Total time: 8 seconds

+ +
+ +

Observation: The build.xml ant file only works on DAS Java binary +distribution.

+ +
+ + + + diff --git a/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetupUtil.java b/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetupUtil.java new file mode 100644 index 0000000000..fbcbe1a5f7 --- /dev/null +++ b/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetupUtil.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.samples.das.databaseSetup; + +import java.sql.Connection; +import java.sql.ResultSet; + +import org.apache.tuscany.das.rdb.dbconfig.DBConfig; +import org.apache.tuscany.das.rdb.dbconfig.DBConfigUtil; +import org.apache.tuscany.das.rdb.dbconfig.DBInitializer; +import org.apache.tuscany.samples.das.tx.manager.GeronimoTransactionManagerUtil; + +/** + * Setup database, XA resources required by the sample + * + * + */ +public class DatabaseSetupUtil { + private static DBConfig dbConfig = null; + /** + * Constructor for DatabaseSetupUtil. + */ + public DatabaseSetupUtil(String dbConfigFile) throws Exception { + //create database tables, data + DBInitializer dbInitializer = new DBInitializer(dbConfigFile); + dbInitializer.refreshDatabaseData(); + //read DAS Config + dbConfig = DBConfigUtil.loadDBConfig(ClassLoader.getSystemResourceAsStream(dbConfigFile)); + } + + public static DBConfig getDBConfig() { + return DatabaseSetupUtil.dbConfig; + } + + public static void main(String[] args) throws Exception{ + //test program + new DatabaseSetupUtil("BankAccountDBConfig.xml"); + GeronimoTransactionManagerUtil tmUtil = new GeronimoTransactionManagerUtil(); + tmUtil.initTransactionManager(); + tmUtil.startTransaction(); + Connection conn = tmUtil.getConnection(); + + ResultSet rs = conn.createStatement().executeQuery("select id, balance from bankaccount"); + while(rs.next()){ + System.out.println("result row: "+rs.getInt(1)+","+rs.getString(2)); + } + + tmUtil.commitTransaction(); + + } +} diff --git a/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerService.java b/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerService.java new file mode 100644 index 0000000000..ee106bec0c --- /dev/null +++ b/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerService.java @@ -0,0 +1,118 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.samples.das.tx.manager; + +import javax.transaction.HeuristicMixedException; +import javax.transaction.HeuristicRollbackException; +import javax.transaction.InvalidTransactionException; +import javax.transaction.NotSupportedException; +import javax.transaction.RollbackException; +import javax.transaction.SystemException; +import javax.transaction.Transaction; +import javax.transaction.TransactionManager; + +import org.apache.geronimo.transaction.manager.TransactionManagerImpl; +import org.apache.geronimo.transaction.manager.XidFactoryImpl; + +/** + * A TransactionManager that delegates to a Geronimo JTA transaction manager. This class serves as a + * wrapper for initializing the Geronimo TM as a system service. + * + * @version $Rev$ $Date$ + */ +public class GeronimoTransactionManagerService implements TransactionManager { + private TransactionManager transactionManager; + private int timeout = 250; + + public GeronimoTransactionManagerService() { + } + + /** + * Returns the transaction timeout in seconds + * + * @return the transaction timeout in seconds + */ + public int getTimeout() { + return timeout; + } + + /** + * Sets the transaction timeout in seconds + */ + public void setTimeout(int timeout) { + this.timeout = timeout; + } + + public void init() throws Exception { + XidFactoryImpl factory = new XidFactoryImpl(); + transactionManager = new TransactionManagerImpl(timeout, factory, null); + } + + public void begin() throws NotSupportedException, SystemException { + transactionManager.begin(); + } + + public void commit() throws HeuristicMixedException, + HeuristicRollbackException, + IllegalStateException, + RollbackException, + SecurityException, + SystemException { + transactionManager.commit(); + } + + public TransactionManager getTransactionManager() { + return transactionManager; + } + + public int getStatus() throws SystemException { + return transactionManager.getStatus(); + } + + public Transaction getTransaction() throws SystemException { + return transactionManager.getTransaction(); + } + + public void resume(Transaction transaction) + throws IllegalStateException, InvalidTransactionException, SystemException { + transactionManager.resume(transaction); + } + + public void rollback() throws IllegalStateException, SecurityException, SystemException { + transactionManager.rollback(); + } + + public void setRollbackOnly() throws IllegalStateException, SystemException { + transactionManager.setRollbackOnly(); + } + + public void setTransactionTimeout(int i) throws SystemException { + transactionManager.setTransactionTimeout(i); + } + + public Transaction suspend() throws SystemException { + return transactionManager.suspend(); + } + + public void begin(long timeout) throws NotSupportedException, SystemException { + transactionManager.begin(); + return; + } + +} diff --git a/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerUtil.java b/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerUtil.java new file mode 100644 index 0000000000..084e735117 --- /dev/null +++ b/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerUtil.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.samples.das.tx.manager; + +import java.sql.Connection; +import java.sql.SQLException; + +import javax.sql.XAConnection; +import javax.sql.XADataSource; +import javax.transaction.xa.XAResource; +import javax.transaction.xa.Xid; + +import org.apache.geronimo.transaction.manager.XidFactory; +import org.apache.geronimo.transaction.manager.XidFactoryImpl; +import org.apache.tuscany.das.rdb.dbconfig.DBConfig; +import org.apache.tuscany.samples.das.databaseSetup.DatabaseSetupUtil; + +import com.mysql.jdbc.jdbc2.optional.MysqlXADataSource; + +public class GeronimoTransactionManagerUtil { + private GeronimoTransactionManagerService service; + private static XADataSource xads; + private static XAConnection xaconn = null; + private static XAResource xares = null; + private static XidFactory xidFact = null; + private static Xid xid = null; + + public void initTransactionManager() { + // Get a transction manager + try { + xidFact = new XidFactoryImpl(); + // creates an instance of Geronimo TM Service + service = new GeronimoTransactionManagerService(); + service.init(); + service.begin(); + initDataSource(); + initXAConnection(); + } catch (Exception e) { + e.printStackTrace(); + System.exit(1); + } + } + + private void initDataSource() { + //setup XADataSource + xads = new MysqlXADataSource(); + try { + DBConfig dbcfg = DatabaseSetupUtil.getDBConfig(); + ((MysqlXADataSource) xads).setUser(dbcfg.getConnectionInfo().getConnectionProperties().getUserName()); + ((MysqlXADataSource) xads).setPassword(dbcfg.getConnectionInfo().getConnectionProperties().getPassword()); + ((MysqlXADataSource) xads).setUrl(dbcfg.getConnectionInfo().getConnectionProperties().getDatabaseURL()); + ((MysqlXADataSource) xads).setURL(dbcfg.getConnectionInfo().getConnectionProperties().getDatabaseURL()); + } catch (Exception e) { + e.printStackTrace(); + System.exit(1); + } + } + + private void initXAConnection() throws SQLException{ + DBConfig dbcfg = DatabaseSetupUtil.getDBConfig(); + xaconn = xads.getXAConnection(dbcfg.getConnectionInfo().getConnectionProperties().getUserName(), + dbcfg.getConnectionInfo().getConnectionProperties().getPassword()); + } + + public void startTransaction() throws Exception { + try{ + //create XAResource + xid= xidFact.createXid(); + xares = xaconn.getXAResource(); + xares.setTransactionTimeout(250); //something + xares.start(xid, XAResource.TMNOFLAGS); + return; + }catch(Exception e) { + e.printStackTrace(); + throw e; + } + } + + public void commitTransaction() throws Exception { + xares.end(xid, XAResource.TMSUCCESS); + xares.prepare(xid); + xares.commit(xid, false); //onePhase=true/false + } + + public void rollbackTransaction() throws Exception { + xares.end(xid, XAResource.TMFAIL); + xares.prepare(xid); + xares.rollback(xid); + } + + public Connection getConnection() throws SQLException { + return xaconn.getConnection(); + } + + /** + * cleanup + */ + public void cleanup() throws Exception{ + xaconn.close(); + xid = null; + xares = null; + xaconn = null; + xads = null; + service.commit(); + } +} diff --git a/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/sample/MoneyTransfer.java b/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/sample/MoneyTransfer.java new file mode 100644 index 0000000000..650f60f089 --- /dev/null +++ b/das-java/trunk/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/sample/MoneyTransfer.java @@ -0,0 +1,193 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.samples.das.tx.sample; + +import java.io.InputStream; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.DAS; +import org.apache.tuscany.samples.das.databaseSetup.DatabaseSetupUtil; +import org.apache.tuscany.samples.das.tx.manager.GeronimoTransactionManagerUtil; + +import commonj.sdo.DataObject; + +/** + * Sample using Geronimo TM to execute multiple DAS applyChanges() under one transaction. + * + */ +public class MoneyTransfer { + + private static final String USAGE = "usage: java MoneyTransfer [commit|rollback] [transferAmount]"; + private static final String SQL_REQUEST = "select id, name, balance from bankaccount"; + private static Connection conn = null; + private static DAS das = null; + + private static void printTable() { + try { + Statement stmt = conn.createStatement(); + ResultSet rset = stmt.executeQuery(SQL_REQUEST); + int numcols = rset.getMetaData().getColumnCount(); + for (int i = 1; i <= numcols; i++) { + System.out.print("\t" + rset.getMetaData().getColumnName(i)); + } + System.out.println(); + while (rset.next()) { + for (int i = 1; i <= numcols; i++) { + System.out.print("\t" + rset.getString(i)); + } + System.out.println(""); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + GeronimoTransactionManagerUtil tmUtil = null; + + if (args.length != 2 || (!args[0].equals("commit") && !args[0].equals("rollback"))) { + System.out.println(USAGE + "\n"); + System.exit(1); + } + + String completion = args[0]; + float transferAmount = 0; + try { + transferAmount = Float.parseFloat(args[1]); + } catch (NumberFormatException e) { + System.out.println(USAGE); + System.out.println("[transferAmount] has to be a float\n"); + System.exit(1); + } + + System.out.println("INIT database"); + try{ + new DatabaseSetupUtil("BankAccountDBConfig.xml"); + }catch(Exception e){ + e.printStackTrace(); + System.exit(1); + } + + try { + System.out.println("INIT transaction manager"); + tmUtil = new GeronimoTransactionManagerUtil(); + tmUtil.initTransactionManager(); + tmUtil.startTransaction(); + } catch (Exception e) { + System.out.println("Exception of type :" + e.getClass().getName() + " has been thrown"); + System.out.println("Exception message :" + e.getMessage()); + e.printStackTrace(); + System.exit(1); + } + + try { + System.out.println("Get a connection"); + conn = tmUtil.getConnection(); + conn.setAutoCommit(false); + } catch (Exception e) { + e.printStackTrace(); + } + + System.out.println("Before transaction, table is:"); + printTable(); + + try { + System.out.println("Begin a transaction"); + init(); //initialize DAS instance + System.out.println("Update the table - 2 accounts"); + withdrawFromBankAccount1(transferAmount); + depositToBankAccount2(transferAmount); + + if (completion.equals("commit")) { + System.out.println("*commit* the transaction"); + tmUtil.commitTransaction(); + } else { + System.out.println("*rollback* the transaction"); + tmUtil.rollbackTransaction(); + } + } catch (Exception e) { + System.out.println("Exception of type :" + e.getClass().getName() + " has been thrown"); + System.out.println("Exception message :" + e.getMessage()); + e.printStackTrace(); + System.exit(1); + } + + System.out.println("After transaction, table is:"); + printTable(); + + System.out.println("Cleanup"); + try { + tmUtil.cleanup(); + } catch (Exception e) { + e.printStackTrace(); + } + + System.out.println("End MoneyTransfer\n"); + System.exit(0); + } + + private static void init(){ + try{ + das = DAS.FACTORY.createDAS(getConfig("BankAccounts.xml"), conn); + }catch(Exception e){ + e.printStackTrace(); + } + } + + /** + * Withdraw asked amount from account1 + * @return + */ + public static final void withdrawFromBankAccount1(float transferAmount) { + Command read = das.getCommand("BankAccount1Data"); + DataObject root = read.executeQuery(); + DataObject account1 = (DataObject)root.getList("BANKACCOUNT").get(0); + float currentBalance = account1.getFloat("BALANCE"); + float newBalance = currentBalance - transferAmount; + account1.setFloat("BALANCE", newBalance); + das.applyChanges(root); + } + + /** + * Deposit asked amount into account2 + * @return + */ + public static final void depositToBankAccount2(float transferAmount) { + Command read = das.getCommand("BankAccount2Data"); + DataObject root = read.executeQuery(); + DataObject account2 = (DataObject)root.getList("BANKACCOUNT").get(0); + float currentBalance = account2.getFloat("BALANCE"); + float newBalance = currentBalance + transferAmount; + account2.setFloat("BALANCE", newBalance); + das.applyChanges(root); + } + + /**Utilities + * + * @param fileName + * @return + */ + private static InputStream getConfig(String fileName) { + MoneyTransfer jdbcExample = new MoneyTransfer(); + return jdbcExample.getClass().getClassLoader().getResourceAsStream(fileName); + } +} diff --git a/das-java/trunk/samples/transaction/src/main/resources/BankAccountDBConfig.xml b/das-java/trunk/samples/transaction/src/main/resources/BankAccountDBConfig.xml new file mode 100644 index 0000000000..1ade9f2341 --- /dev/null +++ b/das-java/trunk/samples/transaction/src/main/resources/BankAccountDBConfig.xml @@ -0,0 +1,34 @@ + + + + + + + + + 1, 'John Feng', 1200 + 2, 'John Feng', 0 +
+ +
diff --git a/das-java/trunk/samples/transaction/src/main/resources/BankAccounts.xml b/das-java/trunk/samples/transaction/src/main/resources/BankAccounts.xml new file mode 100644 index 0000000000..09c1a5bb04 --- /dev/null +++ b/das-java/trunk/samples/transaction/src/main/resources/BankAccounts.xml @@ -0,0 +1,30 @@ + + + + + + + + + + +
+ +
diff --git a/das-java/trunk/tools/pom.xml b/das-java/trunk/tools/pom.xml new file mode 100644 index 0000000000..384ed64c62 --- /dev/null +++ b/das-java/trunk/tools/pom.xml @@ -0,0 +1,147 @@ + + + + 4.0.0 + + org.apache.tuscany.das + tuscany-das + 1.0-SNAPSHOT + + + tuscany-das-tools + Tuscany DAS Tools for Relational Databases + + + + org.apache.tuscany.das + tuscany-das-rdb + ${das.version} + compile + + + + org.apache.tuscany.das.samples + tuscany-das-sample-dbconfig + ${das.version} + compile + + + org.apache.derby + derby + + + + + + org.apache.tuscany.sdo + tuscany-sdo-api-r2.1 + ${sdo.version} + + + + org.apache.tuscany.sdo + tuscany-sdo-impl + ${sdo.version} + + + + org.apache.tuscany.sdo + tuscany-sdo-lib + ${sdo.version} + + + + stax + stax-api + 1.0.1 + + + + org.apache.derby + derby + 10.2.2.0 + test + + + + log4j + log4j + 1.2.14 + compile + + + + junit + junit + 3.8.1 + test + + + + torque + torque-gen + 3.3-RC2 + + + + + + tuscany-das-tools + src/main/java + + + src/main/java + + + src/main/resources + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*Tests.java + + + + + + + + + + + + diff --git a/das-java/trunk/tools/readme.htm b/das-java/trunk/tools/readme.htm new file mode 100644 index 0000000000..9465dc323e --- /dev/null +++ b/das-java/trunk/tools/readme.htm @@ -0,0 +1,78 @@ + + + + + + +Tuscany DAS Tools + + + + + +

Tuscany DAS Tools

+

Building DAS Tools

+ +DBToXSDGenerator provides utility methods for use when DB Schema is available and SDO Model xsds are not. This
+utility will help build SDO Model xsds based on DB Schema. These xsds can be supplied to Data Access Service
+like (RDB-DAS) to have SDO <-> DB data exchange.
+ +
+
    +
  • getModelFileFromDB(String dbInfoFile) - connect to database and convert DB Schema to XSD Model XSDs
  • +
  • getModelFileFromSchemaFile(String schemaFileName, String SDOModelFileName) - no DB Connection needed, but need Apache Torque output of DB schema file
  • +
  • getSchemaFileFromDB(String dbInfoFile) - connect to database and use Apache Torque to get DB Schema xml file
  • +
  • getModelFileFromDB(ModelXSDGenOption mo) - connect to database and convert DB Schema to XSD Model XSDs
  • +
  • getModelFileFromSchemaFile(ModelXSDGenOption mo) - no DB Connection needed, but need Apache Torque output of DB schema file
  • +
  • ModelXSDGenOption holds - schemaFile, modelFile, driverClass, databaseURL, schemaName, userName, password
  • +
+ +To build the Tuscany DAS DBToXSDGenerator tool, perform the following steps
+
    +
  • Ensure that the environment variable JAVA_HOME is set to point to an installation of Java 1.4 JDK
  • +
  • --->To run as a maven plugin, run the command "mvn"
  • +
  • --->To run as a standalone tool, call the above listed methods from DBToXSDGenerator
  • +
+ +Assumption Database exists and contains required tables, constraints. Required Driver jar is in classpath
+ +
    + Example dbInfoFile
    + <Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd">
    +
    + <!--Uncomment below for derby test-->
    + <ConnectionInfo>
    +   <ConnectionProperties
    +     driverClass="org.apache.derby.jdbc.EmbeddedDriver"
    +     databaseURL="jdbc:derby:target/dastest"
    +     schemaName = "APP"
    +     loginTimeout="600000"/>
    + </ConnectionInfo>

    + <OutFiles
    +   schemaFile="target/dbSchema.txt"
    +   modelFile="target/schemaModel.xsd"
    + />
    +</Config> +
+ diff --git a/das-java/trunk/tools/src/main/java/org/apache/tuscany/das/rdb/util/Column.java b/das-java/trunk/tools/src/main/java/org/apache/tuscany/das/rdb/util/Column.java new file mode 100644 index 0000000000..cbadde0717 --- /dev/null +++ b/das-java/trunk/tools/src/main/java/org/apache/tuscany/das/rdb/util/Column.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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; + +public class Column { + private String name; + private String type; + private boolean isPK; + private boolean isRequired; + + protected String getName() { + return name; + } + protected void setName(String name) { + this.name = name; + } + protected String getType() { + return type; + } + protected void setType(String type) { + this.type = type; + } + protected boolean isPK() { + return isPK; + } + protected void setPK(boolean isPK) { + this.isPK = isPK; + } + protected boolean isRequired() { + return isRequired; + } + protected void setRequired(boolean isRequired) { + this.isRequired = isRequired; + } + + public String toString() { + StringBuffer dbSchemaStr = new StringBuffer(); + dbSchemaStr.append("Name:"+this.getName()+", Type:"+this.getType()+", isPK:"+this.isPK()+", isRequired:"+this.isRequired()+"\n"); + return dbSchemaStr.toString(); + } +} diff --git a/das-java/trunk/tools/src/main/java/org/apache/tuscany/das/rdb/util/DBSchema.java b/das-java/trunk/tools/src/main/java/org/apache/tuscany/das/rdb/util/DBSchema.java new file mode 100644 index 0000000000..4ae038b24d --- /dev/null +++ b/das-java/trunk/tools/src/main/java/org/apache/tuscany/das/rdb/util/DBSchema.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.ArrayList; +import java.util.List; + +public class DBSchema { + private List tables = new ArrayList(); + + protected List getTables() { + return tables; + } + + protected void setTables(List tables) { + this.tables = tables; + } + + public String toString() { + StringBuffer dbSchemaStr = new StringBuffer(); + dbSchemaStr.append("_____DB SChema_______\n"); + for(int i=0; i\n"; + String endLine = ""; + + if(xsdModelFileName != null && !xsdModelFileName.trim().equals("")) { + writeFilesToDir = true; + } + + //get all FKs to form a Map - PKtable -> FKTable , e.g. if CITIES has FK such that CITIES.STATE_ID is STATES.ID, then + //the map shall have STATES -> CITIES, TABLE2,... + Hashtable pkTofkTable = new Hashtable(); + + for(int i=0; i\n"; + srcCode = srcCode + " \n"; + + for(int j=0; j\n"; + } + + if(pkTofkTable.get(curTable.getName()) != null) { + ArrayList fkTables = (ArrayList)pkTofkTable.get(curTable.getName()); + + for(int k=0; k\n"; + } + } + + srcCode = srcCode + " \n"; + srcCode = srcCode + "\n\n"; + } + + srcCode = srcCode + endLine; + + File javaFile = new File(xsdModelFileName); + javaFile.createNewFile(); + PrintStream flStrm = new PrintStream(javaFile); + + if(writeFilesToDir) { + flStrm.print(srcCode); + flStrm.flush(); + flStrm.close(); + } else { + System.out.print(srcCode); + } + } +} \ No newline at end of file diff --git a/das-java/trunk/tools/src/main/java/org/apache/tuscany/das/rdb/util/Table.java b/das-java/trunk/tools/src/main/java/org/apache/tuscany/das/rdb/util/Table.java new file mode 100644 index 0000000000..c41085cf2f --- /dev/null +++ b/das-java/trunk/tools/src/main/java/org/apache/tuscany/das/rdb/util/Table.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.ArrayList; +import java.util.List; + +public class Table { + private String name; + private List columns = new ArrayList(); + private List fks = new ArrayList(); + + protected String getName() { + return name; + } + protected void setName(String name) { + this.name = name; + } + protected List getColumns() { + return columns; + } + protected void setColumns(List columns) { + this.columns = columns; + } + protected List getFks() { + return fks; + } + protected void setFks(List fks) { + this.fks = fks; + } + + public String toString() { + StringBuffer dbSchemaStr = new StringBuffer(); + dbSchemaStr.append("_____Table_______"+this.name+"\n"); + dbSchemaStr.append("_____Columns_______\n"); + for(int i=0; i 0) + dbSchemaStr.append("_____FKs_______\n"); + for(int i=0; i"; + String compare2 = ""; + String compare3 = ""; + String compare4 = ""; + + public void testDBToSchemaFile() throws Exception { + DBToXSDGenerator.getSchemaFileFromDB("DBConnectionConfig.xml"); + File file = new File("target/dbSchema.txt"); + if(file.isFile()) { + String schemaContent = getContents(file); + if(schemaContent.indexOf(compare1) != -1 && schemaContent.indexOf(compare2) != -1) { + assertTrue(true); + } + } else { + fail("SchemaFile does not exists or has improper contents!"); + } + } + + public void testSchemaFileToXSD() throws Exception { + DBToXSDGenerator.getModelFileFromSchemaFile("target/dbSchema.txt", "target/schemaModel.xsd"); + + File modelfile = new File("target/schemaModel.xsd"); + if(modelfile.isFile()) { + String modelContent = getContents(modelfile); + if(modelContent.indexOf(compare3) != -1 && modelContent.indexOf(compare4) != -1) { + assertTrue(true); + } + } else { + fail("ModelFile does not exists or has improper contents!"); + } + } + + public void testDBToXSD() throws Exception { + DBToXSDGenerator.getModelFileFromDB("DBConnectionConfig.xml"); + + File file = new File("target/dbSchema.txt"); + if(file.isFile()) { + String schemaContent = getContents(file); + if(schemaContent.indexOf(compare1) != -1 && schemaContent.indexOf(compare2) != -1) { + assertTrue(true); + } + } else { + fail("SchemaFile does not exists or has improper contents!"); + } + + File modelfile = new File("target/schemaModel.xsd"); + if(modelfile.isFile()) { + String modelContent = getContents(modelfile); + if(modelContent.indexOf(compare3) != -1 && modelContent.indexOf(compare4) != -1) { + assertTrue(true); + } + } else { + fail("ModelFile does not exists or has improper contents!"); + } + } +} diff --git a/das-java/trunk/tools/src/test/resources/DBConnectionConfig.xml b/das-java/trunk/tools/src/test/resources/DBConnectionConfig.xml new file mode 100644 index 0000000000..c00bd462db --- /dev/null +++ b/das-java/trunk/tools/src/test/resources/DBConnectionConfig.xml @@ -0,0 +1,31 @@ + + + + + + + + + + diff --git a/das-java/trunk/tools/src/test/resources/dbConfig.xml b/das-java/trunk/tools/src/test/resources/dbConfig.xml new file mode 100644 index 0000000000..b990d5cd0f --- /dev/null +++ b/das-java/trunk/tools/src/test/resources/dbConfig.xml @@ -0,0 +1,34 @@ + + + + + + +
+
+ +
+ diff --git a/java/das/distribution/binary/DISCLAIMER b/java/das/distribution/binary/DISCLAIMER deleted file mode 100644 index a65af91c5a..0000000000 --- a/java/das/distribution/binary/DISCLAIMER +++ /dev/null @@ -1,7 +0,0 @@ -Apache Tuscany is an effort undergoing incubation at The Apache Software -Foundation (ASF), sponsored by the Apache 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. \ No newline at end of file diff --git a/java/das/distribution/binary/LICENSE b/java/das/distribution/binary/LICENSE deleted file mode 100644 index 9597d92eb3..0000000000 --- a/java/das/distribution/binary/LICENSE +++ /dev/null @@ -1,353 +0,0 @@ - - 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. - -=============================================================================================================== - -Other components and dependencies under Apache Software License 2.0 : - - log4j-1.2.14.jar - Apache Logging Services - derby 10.2.2.0.jar - Apache Derby - stax-api-1.0.1.jar - The Streaming API for XML (StAX) - wstx-asl-3.2.0.jar - WoodStox StAX implementation - standard-1.1.1.jar - The Apache Jackarta Taglibs - jstl-1.1.2.jar - The Apache Jackarta Taglibs - *.tld - The Apache Jackarta Taglibs - -=============================================================================================================== - - -Apache Tuscany SDO for Java Subcomponents -=========================================: - -The Tuscany SDO for Java release 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. - -License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar) - -Permission to copy, make derivative works of, and distribute the Service Data Objects -JavaDoc and Interface Definition Files files in any medium without fee or royalty as part -of a compliant implementation of the Service Data Objects Specification is hereby granted. -The Service Data Objects Specification may be found at any of the following locations: - -http://dev2dev.bea.com/technologies/commonj/index.jsp -http://www.ibm.com/developerworks/library/specification/ws-sdo/ -http://oracle.com/technology/webservices/sca -https://www.sdn.sap.com/ -http://www.xcalia/xdn/specs/sdo - -THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES -ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS -SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS, -INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, -NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE -SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES. - -The name and trademarks of the Authors may NOT be used in any manner, including advertising or -publicity pertaining to the Service Component Architecture Specification or its contents without specific, -written prior permission. Title to copyright in the Service Data Objects Specification and the -JavaDoc and Interface Definition Files will at all times remain with the Authors. - -No other rights are granted by implication, estoppel or otherwise. - -================================================================================================================= - -For the Eclipse EMF components -(codegen-2.2.3.jar -codegen-ecore-2.2.3.jar -common-2.2.3.jar -ecore-2.2.3.jar -ecore-change-2.2.3.jar -ecore-xmi-2.2.3.jar -xsd-2.2.3.jar) - -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. - -=================================================================================================== diff --git a/java/das/distribution/binary/NOTICE b/java/das/distribution/binary/NOTICE deleted file mode 100644 index 69a83ad3a1..0000000000 --- a/java/das/distribution/binary/NOTICE +++ /dev/null @@ -1,24 +0,0 @@ -Apache Tuscany SDO for Java -Copyright 2006, 2007 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - -Unless otherwise indicated, all distribution made available by the Apache Software Foundation -is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL"). -A copy of the AL is provided with this distribution as the LICENSE file present in the -root directory, and is also available at http://www.apache.org/licenses/. - -The terms and conditions governing the distribution may refer to the AL or other license -agreements, notices or terms and conditions. Some of these other license agreements may -include (but are not limited to): - - . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html) - -It is your obligation to read and accept all such terms and conditions prior to use of the -distribution. If term or condition is provided, please contact the Apache Software Foundation -to determine what terms and conditions govern that particular distribution. - -This product also includes software developed by the Open Service Oriented Architecture organisation -(http://osoa.org). The license for this software may be found in the LICENSE file contained in this -distribution. diff --git a/java/das/distribution/binary/README b/java/das/distribution/binary/README deleted file mode 100644 index 8d292cbb06..0000000000 --- a/java/das/distribution/binary/README +++ /dev/null @@ -1,10 +0,0 @@ - Apache Tuscany - ------------------------------------------- - -Welcome to Tuscany! Please read the release notes (RELEASE_NOTES) in this directory for -details on the current release. - -Thanks from all of us on the Tuscany team for downloading the package; help -us make it better by sending comments to tuscany-user@ws.apache.org. - - diff --git a/java/das/distribution/binary/RELEASE_NOTES b/java/das/distribution/binary/RELEASE_NOTES deleted file mode 100644 index b9c205a75e..0000000000 --- a/java/das/distribution/binary/RELEASE_NOTES +++ /dev/null @@ -1,33 +0,0 @@ -DAS - Data Access Services - -Service Data Object(SDO) provides a uniform API for handling different types of data. Data Access Service (DAS) -simplifies handling of data when interacting with the back-end data source and frees application developers -from dealing with tedious and error-prone transformation between end source types and SDO Data Object Types/properties.. - -What's new in Apache Tuscany DAS beta2 -====================================== - - The main purpose of the DAS beta2 release is to fix incompatibilites that were found with SDO 1.0 release. - - The following JIRAs also were fixed on DAS beta2 - - - TUSCANY-986 - DAS integration with SDO 2.1 APIs - - TUSCANY-961 - DAS: Using deprected SDO method causes Type lookup failure - - TUSCANY-1353 - Exception attempting to insert rows using DAS w/DataDirect JDBC driver - - TUSCANY-1453 - DAS can't read or write the blob field - - TUSCANY-1463 - Support for Clob and Array fields - - TUSCANY-1462 - Consistent use of Parameters in Config - - TUSCANY-1464 - Wrong query results when SELECT misses PKs - - TUSCANY-1465 - Allow passing ResultDescriptor for dynamic Commands - - TUSCANY-1720 - Modify sample readmes for - steps to run sample with other databases - - - -Details are described below. - - DAS Java beta2 is a superset of previous DAS Java M1,M2 and Beta1 releases. - Anything in these previous releases is also in beta2, but beta2 contains features and bug fixes not present on them. - -Compatibility Concerns - - - SDO Static types should be regenerated based on SDO 1.0 tools. diff --git a/java/das/distribution/binary/pom.xml b/java/das/distribution/binary/pom.xml deleted file mode 100644 index 6fec609dac..0000000000 --- a/java/das/distribution/binary/pom.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.das - tuscany-das - 1.0-SNAPSHOT - - - org.apache.tuscany.das.distribution - tuscany-das-bin - pom - Tuscany DAS Distribution (Binary) - Tuscany Distribution for DAS. - - - - org.apache.tuscany.das - tuscany-das-rdb - ${das.version} - - - - org.apache.tuscany.das.samples - tuscany-das-sample-company-webapp - ${das.version} - war - - - - org.apache.tuscany.das.samples - tuscany-das-sample-customer - ${das.version} - - - - org.apache.tuscany.das.samples - tuscany-das-sample-advanced-webapp - ${das.version} - war - - - - org.apache.tuscany.das.samples - tuscany-das-sample-transaction - ${das.version} - - - - org.apache.tuscany.das - tuscany-das-tools - ${das.version} - - - - - install - tuscany-das-${das.version} - - - org.apache.maven.plugins - maven-assembly-plugin - 2.2-beta-3 - - - package - - single - - - - - - src/main/assembly/das.xml - - - - - - diff --git a/java/das/distribution/binary/src/main/assembly/das.xml b/java/das/distribution/binary/src/main/assembly/das.xml deleted file mode 100644 index 0d916640fd..0000000000 --- a/java/das/distribution/binary/src/main/assembly/das.xml +++ /dev/null @@ -1,174 +0,0 @@ - - - - bin - false - - zip - tar.gz - - - - - - tuscany-das-${das.version} - - LICENSE* - NOTICE* - DISCLAIMER* - README* - RELEASE_NOTES* - - - - - - - ../../rdb/target/apidocs - tuscany-das-${das.version}/doc - - - - - - - - ../../samples/company-webapp/readme.htm - tuscany-das-${das.version}/samples/company-webapp - 0644 - - - - ../../samples/company-webapp/target/sample-company-webapp.war - tuscany-das-${das.version}/samples/company-webapp - 0644 - - - - - - - ../../samples/advanced-webapp/readme.htm - tuscany-das-${das.version}/samples/advanced-webapp - 0644 - - - - ../../samples/advanced-webapp/target/sample-advanced-webapp.war - tuscany-das-${das.version}/samples/advanced-webapp - 0644 - - - - - - ../../samples/customer/readme.htm - tuscany-das-${das.version}/samples/customer - 0644 - - - - ../../samples/customer/target/sample-customer.jar - tuscany-das-${das.version}/samples/customer - 0644 - - - ../../samples/customer/build.xml - tuscany-das-${das.version}/samples/customer - 0644 - - - - - ../../samples/transaction/readme.htm - tuscany-das-${das.version}/samples/transaction - 0644 - - - - ../../samples/transaction/target/sample-transaction.jar - tuscany-das-${das.version}/samples/transaction - 0644 - - - ../../samples/transaction/build.xml - tuscany-das-${das.version}/samples/transaction - 0644 - - - - - ../../tools/readme.htm - tuscany-das-${das.version}/tuscany-das-tools - 0644 - - - - ../../tools/target/tuscany-das-tools.jar - tuscany-das-${das.version}/tuscany-das-tools - 0644 - - - - - - - - - tuscany-das-${das.version}/lib - - org.apache.tuscany.das:tuscany-das-rdb - - 0644 - - - - - tuscany-das-${das.version}/samples/customer - - org.apache.derby:derby - - 0644 - - - - - tuscany-das-${das.version}/samples/transaction - - mysql:mysql-connector-java - org.apache.geronimo.specs:geronimo-jta_1.1_spec - org.apache.geronimo.components:geronimo-transaction - org.apache.geronimo.specs:geronimo-j2ee-connector_1.5_spec - org.apache.tuscany.das.samples:tuscany-das-sample-dbconfig - - 0644 - - - - - tuscany-das-${das.version}/tuscany-das-tools - - torque:torque-gen - - 0644 - - - - diff --git a/java/das/distribution/source/BUILDING b/java/das/distribution/source/BUILDING deleted file mode 100644 index edc05e6cec..0000000000 --- a/java/das/distribution/source/BUILDING +++ /dev/null @@ -1,47 +0,0 @@ -Building the Apache Tuscany DAS beta1 -===================================== - -Initial Setup -------------- - -1) Install J2SE 5.0 SDK, which can be downloaded from - http://java.sun.com/j2se/1.5.0/download.jsp. Use version of 1.5.0_06 JDK. - -2) Make sure that your JAVA_HOME environment variable is set to the newly installed - JDK location, and that your PATH includes %JAVA_HOME%\bin (windows) or - $JAVA_HOME$/bin (unix). - -3) Install Maven 2.0.5, which can be downloaded from http://maven.apache.org/download.html. - Make sure that your PATH includes the MVN_HOME/bin directory. - - -Building --------- - -1) Change to the top level directory to Apache Tuscany source distribution. -2) Run - - $> mvn - - This will compile Apache Tuscany DAS and run all of the tests in the source - distribution. - - Depending on the load of remote Maven 2.0 repositories, you may have - to run "mvn" several times utill the required dependencies are - all located in your local maven repository. It usually takes some time for - maven to download required dependencies in the first build. Once all the - dependencies have been downloaded you may use the -o option to run maven - in offline mode, for example, 'mvn clean install -o'. - - -Building the distributions --------------------------- - -1) Change to the top level directory to Apache Tuscany source distribution. -2) If you haven't run a complete build, please follow the steps above -3) Run - - $> mvn -Pdistribution - - This will build the binary and source distribution with .zip and .gz - formats in the distribution/target directory. diff --git a/java/das/distribution/source/DISCLAIMER b/java/das/distribution/source/DISCLAIMER deleted file mode 100644 index a65af91c5a..0000000000 --- a/java/das/distribution/source/DISCLAIMER +++ /dev/null @@ -1,7 +0,0 @@ -Apache Tuscany is an effort undergoing incubation at The Apache Software -Foundation (ASF), sponsored by the Apache 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. \ No newline at end of file diff --git a/java/das/distribution/source/LICENSE b/java/das/distribution/source/LICENSE deleted file mode 100644 index 9597d92eb3..0000000000 --- a/java/das/distribution/source/LICENSE +++ /dev/null @@ -1,353 +0,0 @@ - - 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. - -=============================================================================================================== - -Other components and dependencies under Apache Software License 2.0 : - - log4j-1.2.14.jar - Apache Logging Services - derby 10.2.2.0.jar - Apache Derby - stax-api-1.0.1.jar - The Streaming API for XML (StAX) - wstx-asl-3.2.0.jar - WoodStox StAX implementation - standard-1.1.1.jar - The Apache Jackarta Taglibs - jstl-1.1.2.jar - The Apache Jackarta Taglibs - *.tld - The Apache Jackarta Taglibs - -=============================================================================================================== - - -Apache Tuscany SDO for Java Subcomponents -=========================================: - -The Tuscany SDO for Java release 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. - -License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar) - -Permission to copy, make derivative works of, and distribute the Service Data Objects -JavaDoc and Interface Definition Files files in any medium without fee or royalty as part -of a compliant implementation of the Service Data Objects Specification is hereby granted. -The Service Data Objects Specification may be found at any of the following locations: - -http://dev2dev.bea.com/technologies/commonj/index.jsp -http://www.ibm.com/developerworks/library/specification/ws-sdo/ -http://oracle.com/technology/webservices/sca -https://www.sdn.sap.com/ -http://www.xcalia/xdn/specs/sdo - -THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES -ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS -SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS, -INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, -NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE -SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES. - -The name and trademarks of the Authors may NOT be used in any manner, including advertising or -publicity pertaining to the Service Component Architecture Specification or its contents without specific, -written prior permission. Title to copyright in the Service Data Objects Specification and the -JavaDoc and Interface Definition Files will at all times remain with the Authors. - -No other rights are granted by implication, estoppel or otherwise. - -================================================================================================================= - -For the Eclipse EMF components -(codegen-2.2.3.jar -codegen-ecore-2.2.3.jar -common-2.2.3.jar -ecore-2.2.3.jar -ecore-change-2.2.3.jar -ecore-xmi-2.2.3.jar -xsd-2.2.3.jar) - -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. - -=================================================================================================== diff --git a/java/das/distribution/source/NOTICE b/java/das/distribution/source/NOTICE deleted file mode 100644 index 69a83ad3a1..0000000000 --- a/java/das/distribution/source/NOTICE +++ /dev/null @@ -1,24 +0,0 @@ -Apache Tuscany SDO for Java -Copyright 2006, 2007 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - -Unless otherwise indicated, all distribution made available by the Apache Software Foundation -is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL"). -A copy of the AL is provided with this distribution as the LICENSE file present in the -root directory, and is also available at http://www.apache.org/licenses/. - -The terms and conditions governing the distribution may refer to the AL or other license -agreements, notices or terms and conditions. Some of these other license agreements may -include (but are not limited to): - - . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html) - -It is your obligation to read and accept all such terms and conditions prior to use of the -distribution. If term or condition is provided, please contact the Apache Software Foundation -to determine what terms and conditions govern that particular distribution. - -This product also includes software developed by the Open Service Oriented Architecture organisation -(http://osoa.org). The license for this software may be found in the LICENSE file contained in this -distribution. diff --git a/java/das/distribution/source/README b/java/das/distribution/source/README deleted file mode 100644 index 8d292cbb06..0000000000 --- a/java/das/distribution/source/README +++ /dev/null @@ -1,10 +0,0 @@ - Apache Tuscany - ------------------------------------------- - -Welcome to Tuscany! Please read the release notes (RELEASE_NOTES) in this directory for -details on the current release. - -Thanks from all of us on the Tuscany team for downloading the package; help -us make it better by sending comments to tuscany-user@ws.apache.org. - - diff --git a/java/das/distribution/source/RELEASE_NOTES b/java/das/distribution/source/RELEASE_NOTES deleted file mode 100644 index b9c205a75e..0000000000 --- a/java/das/distribution/source/RELEASE_NOTES +++ /dev/null @@ -1,33 +0,0 @@ -DAS - Data Access Services - -Service Data Object(SDO) provides a uniform API for handling different types of data. Data Access Service (DAS) -simplifies handling of data when interacting with the back-end data source and frees application developers -from dealing with tedious and error-prone transformation between end source types and SDO Data Object Types/properties.. - -What's new in Apache Tuscany DAS beta2 -====================================== - - The main purpose of the DAS beta2 release is to fix incompatibilites that were found with SDO 1.0 release. - - The following JIRAs also were fixed on DAS beta2 - - - TUSCANY-986 - DAS integration with SDO 2.1 APIs - - TUSCANY-961 - DAS: Using deprected SDO method causes Type lookup failure - - TUSCANY-1353 - Exception attempting to insert rows using DAS w/DataDirect JDBC driver - - TUSCANY-1453 - DAS can't read or write the blob field - - TUSCANY-1463 - Support for Clob and Array fields - - TUSCANY-1462 - Consistent use of Parameters in Config - - TUSCANY-1464 - Wrong query results when SELECT misses PKs - - TUSCANY-1465 - Allow passing ResultDescriptor for dynamic Commands - - TUSCANY-1720 - Modify sample readmes for - steps to run sample with other databases - - - -Details are described below. - - DAS Java beta2 is a superset of previous DAS Java M1,M2 and Beta1 releases. - Anything in these previous releases is also in beta2, but beta2 contains features and bug fixes not present on them. - -Compatibility Concerns - - - SDO Static types should be regenerated based on SDO 1.0 tools. diff --git a/java/das/distribution/source/pom.xml b/java/das/distribution/source/pom.xml deleted file mode 100644 index d6fe42ce63..0000000000 --- a/java/das/distribution/source/pom.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.das - tuscany-das - 1.0-SNAPSHOT - - - org.apache.tuscany.das.distribution - tuscany-das-src - pom - Tuscany DAS Distribution (Source) - Tuscany Distribution for DAS. - - - - org.apache.tuscany.das - tuscany-das-rdb - ${das.version} - - - - - install - tuscany-das-${das.version} - - - org.apache.maven.plugins - maven-assembly-plugin - 2.2-beta-3 - - - package - - single - - - - - - src/main/assembly/src.xml - - - - - - diff --git a/java/das/distribution/source/src/main/assembly/src.xml b/java/das/distribution/source/src/main/assembly/src.xml deleted file mode 100644 index 593e1bccd2..0000000000 --- a/java/das/distribution/source/src/main/assembly/src.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - src - tuscany-das-${das.version}-src - - zip - tar.gz - - - - - BUILDING* - LICENSE* - NOTICE* - DISCLAIMER* - README* - RELEASE_NOTES* - pom.xml - - true - - - ../../ - - true - - keep - - **/*.* - - - **/ldap/** - **/target/** - **/dastest/** - **/.settings/** - **/**.mdl - **/derby.log - **/.project - **/.classpath - - 0644 - - - \ No newline at end of file diff --git a/java/das/plugin/pom.xml b/java/das/plugin/pom.xml deleted file mode 100644 index c64751d03d..0000000000 --- a/java/das/plugin/pom.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - - org.apache.tuscany.das - tuscany-das - 1.0-SNAPSHOT - - 4.0.0 - tuscany-das-plugin - maven-plugin - Tuscany DAS Maven Plugin - - - - org.apache.maven - maven-plugin-api - 2.0.4 - compile - - - org.apache.maven - maven-model - 2.0.4 - - - org.apache.maven - maven-project - 2.0.4 - compile - - - org.apache.maven - maven-plugin-descriptor - 2.0.4 - compile - - - - org.apache.derby - derby - 10.2.2.0 - - - - torque - torque-gen - 3.3-RC2 - - - - org.apache.tuscany.das - tuscany-das-tools - ${das.version} - compile - - - - - - plugin-test - - - - org.apache.tuscany.das - tuscany-das-plugin - ${das.version} - - - dbToxsd - generate-resources - - ${basedir}/target/schema.xml - ${basedir}/target/sdoModel.xsd - org.apache.derby.jdbc.EmbeddedDriver - jdbc:derby:${basedir}/../rdb/target/dastest - APP - - - generate - - - - - - - - - - \ No newline at end of file diff --git a/java/das/plugin/src/main/java/org/apache/tuscany/das/plugin/GeneratorMojo.java b/java/das/plugin/src/main/java/org/apache/tuscany/das/plugin/GeneratorMojo.java deleted file mode 100644 index 3c0b671ec7..0000000000 --- a/java/das/plugin/src/main/java/org/apache/tuscany/das/plugin/GeneratorMojo.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.plugin; - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.tuscany.das.rdb.util.DBToXSDGenerator; -import org.apache.tuscany.das.rdb.util.ModelXSDGenOption; - -/** - * @goal generate - * @phase generate-resources - * @description Generate XSD Model files from DB Schema or db schema XML file - */ -public class GeneratorMojo extends AbstractMojo { - /** - * The file containing db schema in xml - * - * @parameter property="schemaFile" - */ - private String schemaFile; - - /** - * The file that will contain Static SDO Model XSD - * @parameter - */ - private String modelFile; - - /** - * Specifies the driverClass to use for connecting to database. - * - * @parameter - */ - private String driverClass; - - /** - * Specifies the databaseURL - * - * @parameter - */ - private String databaseURL; - - /** - * DB Schema name. - * - * @parameter - */ - private String schemaName; - - /** - * Optional user name. - * - * @parameter - */ - private String userName; - - /** - * Optional password. - * - * @parameter - */ - private String password; - - public void execute() throws MojoExecutionException { - //if driverClass, databaseURL and schemaName present, use it to connect to DB , - //if any from these 3 is absent, and schemaFile is present use it as input - ModelXSDGenOption mo = new ModelXSDGenOption(); - if (null != driverClass && null != databaseURL && null != schemaName && null != schemaFile) { - mo.setDriverClass(driverClass); - mo.setDatabaseURL(databaseURL); - mo.setSchemaName(schemaName); - mo.setUserName(userName); - mo.setPassword(password); - mo.setSchemaFile(schemaFile); - mo.setModelFile(modelFile); - - try { - DBToXSDGenerator.getModelFileFromDB(mo); - } catch(Exception e) { - throw new MojoExecutionException(e.getMessage()); - } - } else if(null != schemaFile) { - mo.setSchemaFile(schemaFile); - mo.setModelFile(modelFile); //if null, STDOUT - try { - DBToXSDGenerator.getModelFileFromSchemaFile(mo); - } catch(Exception e) { - throw new MojoExecutionException(e.getMessage()); - } - } else { - throw new MojoExecutionException("Provide DB Connection info or DB Schema XML file!"); - } - } -} \ No newline at end of file diff --git a/java/das/pom.xml b/java/das/pom.xml deleted file mode 100644 index 56efdcd33a..0000000000 --- a/java/das/pom.xml +++ /dev/null @@ -1,160 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany - parent - 3-SNAPSHOT - - org.apache.tuscany.das - tuscany-das - 1.0-SNAPSHOT - pom - Apache Tuscany DAS Implementation project - - - scm:svn:http://svn.apache.org/repos/asf/tuscany/java/das - scm:svn:https://svn.apache.org/repos/asf/tuscany/java/das - http://svn.apache.org/repos/asf/tuscany/java/das/ - - - - 1.0-SNAPSHOT - 1.1.1 - - - - - - apache.snapshots - Apache Snapshot Repository - http://people.apache.org/repo/m2-snapshot-repository - - false - - - true - - - - apache.incubator - Apache Incubator Repository - http://people.apache.org/repo/m2-incubating-repository/ - - true - - - false - - - - - - - - org.apache.tuscany.sdo - tuscany-sdo-impl - ${sdo.version} - compile - - - - junit - junit - 3.8.1 - test - - - - - - install - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.4 - 1.4 - - - - org.apache.maven.plugins - maven-surefire-plugin - - - **/*TestCase.java - - brief - false - - - - org.apache.maven.plugins - maven-jar-plugin - - - - ${project.artifactId} - ${name} - The Apache Software Foundation - ${version} - ${name} - org.apache - The Apache Software Foundation - ${version} - - - - 2.1 - - - - - - - default - - true - - - - rdb - samples - tools - plugin - - - - - distribution - - rdb - samples - tools - plugin - distribution/binary - distribution/source - - - - - diff --git a/java/das/rdb/pom.xml b/java/das/rdb/pom.xml deleted file mode 100644 index 059a08c52b..0000000000 --- a/java/das/rdb/pom.xml +++ /dev/null @@ -1,272 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.das - tuscany-das - 1.0-SNAPSHOT - - - tuscany-das-rdb - Tuscany DAS for Relational Databases - - - - org.apache.tuscany.sdo - tuscany-sdo-api-r2.1 - ${sdo.version} - - - - org.apache.tuscany.sdo - tuscany-sdo-impl - ${sdo.version} - - - - org.apache.tuscany.sdo - tuscany-sdo-lib - ${sdo.version} - - - - stax - stax-api - 1.0.1 - - - - org.apache.derby - derby - 10.2.2.0 - test - - - - log4j - log4j - 1.2.14 - compile - - - - junit - junit - 3.8.1 - test - - - - - install - - - - - - default - - true - - - - - - org.apache.tuscany.sdo - tuscany-sdo-plugin - ${sdo.version} - - - config - - ${basedir}/src/main/resources/config.xsd - true - true - - - generate - - - - companynoid - - ${basedir}/src/test/resources/companynoid.xsd - true - - - generate - - - - company - - ${basedir}/src/test/resources/company.xsd - true - - - generate - - - - customer - - ${basedir}/src/test/resources/customer.xsd - true - - - generate - - - - singer - - ${basedir}/src/test/resources/SINGER.xsd - true - - - generate - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - **/*AllTestsDerby.java - - - - - - - - - - distribution - - - - - org.apache.tuscany.sdo - tuscany-sdo-plugin - ${sdo.version} - - - config - - ${basedir}/src/main/resources/config.xsd - true - true - - - generate - - - - companynoid - - ${basedir}/src/test/resources/companynoid.xsd - true - - - generate - - - - company - - ${basedir}/src/test/resources/company.xsd - true - - - generate - - - - customer - - ${basedir}/src/test/resources/customer.xsd - true - - - generate - - - - singer - - ${basedir}/src/test/resources/SINGER.xsd - true - - - generate - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - **/*AllTestsDerby.java - - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.2 - - 2.0 - true - 0 - false - - - - package - package - - jar - - - - - - - - - - - - - - - - diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Command.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Command.java deleted file mode 100644 index 1e641b71e7..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Command.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.IOException; -import java.io.OutputStream; -import java.util.List; - -import org.apache.tuscany.das.rdb.config.ResultDescriptor; - -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 - */ - void execute(); - - /** - * Performs the function defined by the command and return the results in the root DataObject - * - * @return the root DataObject - */ - DataObject executeQuery(); - - /** - * Sets the value of the associated Parameter - * - * @param index - * the index of the Parameter - * @param value - * the value for the Parameter - */ - 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 - */ - Object getParameter(int index); - - /** - * - * @param name Name of parameter - should match exact name of database table column - * as appearing in Command - * @param value - * the value of the parameter - */ - void setParameter(String name, Object value); - - /** - * - * @param name - * the name of the parameter - should match exact name of database table column - * @return the value of the parameter - */ - Object getParameter(String name); - - /** - * 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 - */ - int getGeneratedKey(); - - /** - * Allow set of ResultDescriptor when command is created on-the-fly - * @param resultDescriptorList - */ - void setResultDescriptors(List resultDescriptorList); - - List getResultDescriptors(); - - /** - * Add/replace based on columnIndex (>=0)embedded in resultDescriptor else add at end - * @param resultDescriptor - */ - void addResultDescriptor(ResultDescriptor resultDescriptor); - - /** - * remove ResultDescriptor at given columnIndex(>=0) and return same. If not - * present return null. For -ve index, return null - * @param columnIndex - * @return - */ - ResultDescriptor removeResultDescriptor(int columnIndex); - - /** - * Remove resultDescriptor only if matched for index(>=0), name, type, schema - * name and table name and return same, else return null For -ve index, ignore - * index and if unique match for rest of the attriutes, remove/return, if multiple - * matches found, throw RuntimeException - * @param resultDescriptor - * @return - */ - ResultDescriptor removeResultDescriptor(ResultDescriptor resultDescriptor); - - /** - * Return resultDescriptor if exact match for columnIndex(>=0) found - * else return null; - * - * @param columnIndex - * @return - */ - ResultDescriptor getResultDescriptor(int columnIndex); - - /** - * Utility method - * @param ostrm - * @throws IOException - */ - void printResultDescriptors(OutputStream ostrm) throws IOException; -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ConfigHelper.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ConfigHelper.java deleted file mode 100644 index d4582374e1..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ConfigHelper.java +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.util.Vector; - -import org.apache.tuscany.das.rdb.config.Column; -import org.apache.tuscany.das.rdb.config.Command; -import org.apache.tuscany.das.rdb.config.Config; -import org.apache.tuscany.das.rdb.config.ConfigFactory; -import org.apache.tuscany.das.rdb.config.Parameters; -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.impl.ParametersExtendedImpl; -import org.apache.tuscany.das.rdb.util.ConfigUtil; - -/** - * 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 = ConfigFactory.INSTANCE; - - /** - * Default constructor - */ - public ConfigHelper() { - config = factory.createConfig(); - configWrapper = new MappingWrapper(config); - } - - /** - * Constructor that receives a Config stream - * This is usefull to extend a config file - * @param configStream The configuration stream - */ - public ConfigHelper(InputStream configStream) { - this.config = ConfigUtil.loadConfig(configStream); - configWrapper = new MappingWrapper(config); - } - - /** - * Constructor that receives a Config object - * @param config The configuration object - */ - public ConfigHelper(Config config) { - this.config = config; - configWrapper = new MappingWrapper(config); - } - - /** - * Add PK information - * @param columnName The column to be taken as PK - */ - public void addPrimaryKey(String columnName) { - configWrapper.addPrimaryKey(columnName); - } - - /** - * Add PK information, with different TypeName - * @param columnName - * @param typeName - */ - public void addPrimaryKey(String columnName, String propertyName) { - configWrapper.addPrimaryKey(columnName, propertyName); - } - - /** - * Add relationship information - * @param parentName - * @param childName - * @return - */ - public Relationship addRelationship(String parentName, String childName) { - return addRelationship(parentName, childName, null); - } - - /** - * Add relationship information - * @param parentName - * @param childName - * @param relationshipName - * @return - */ - public Relationship addRelationship(String parentName, String childName, String relationshipName) { - return configWrapper.addRelationship(parentName, childName, relationshipName); - } - - /** - * Add relationship information - * @param parentNames - * @param childNames - * @return - */ - public Relationship addRelationship(Vector parentNames, Vector childNames) { - return addRelationship(parentNames, childNames, null); - } - - /** - * Add relationship information - * @param parentNames - * @param childNames - * @param relationshipName - * @return - */ - public Relationship addRelationship(Vector parentNames, Vector childNames, String relationshipName) { - return configWrapper.addRelationship(parentNames, childNames, relationshipName); - } - - /** - * Add table information - * @param name - * @param typeName - * @return - */ - public Table addTable(String name, String typeName) { - return configWrapper.addTable(name, typeName); - } - - /** - * Add table information with schema information - * @param name - * @param schemaName - * @param typeName - * @return - */ - public Table addTable(String name, String schemaName, String typeName) { - return configWrapper.addTable(name, schemaName, typeName); - } - - /** - * Add column information - * @param table - * @param columnName - * @param propertyName - * @return - */ - public Column addColumn(Table table, String columnName, String propertyName) { - return configWrapper.addColumn(table, columnName, propertyName); - } - - /** - * Add an update statement for a given table - * @param table - * @param statement - * @param parameters String - names separated with space - */ - public void addUpdateStatement(Table table, String statement, String parameters) { - ParametersExtendedImpl parametersExtendedImpl = new ParametersExtendedImpl(); - parametersExtendedImpl.addParameters(ParametersExtendedImpl.getParameters(parameters)); - configWrapper.addUpdateStatement(table, statement, parametersExtendedImpl); - } - - /** - * Add an update statement for a given table - * @param table - * @param statement - * @param parameters - */ - public void addUpdateStatement(Table table, String statement, Parameters parameters) { - configWrapper.addUpdateStatement(table, statement, parameters); - } - - /** - * Add create statement for a given table - * @param table - * @param statement - * @param parameters String - names separated with space - */ - public void addCreateStatement(Table table, String statement, String parameters) { - ParametersExtendedImpl parametersExtendedImpl = new ParametersExtendedImpl(); - parametersExtendedImpl.addParameters(ParametersExtendedImpl.getParameters(parameters)); - configWrapper.addCreateStatement(table, statement, parametersExtendedImpl); - } - - /** - * Add create statement for a given table - * @param table - * @param statement - * @param parameters - */ - public void addCreateStatement(Table table, String statement, Parameters parameters) { - configWrapper.addCreateStatement(table, statement, parameters); - } - - /** - * Add delete statement for a given table - * @param table - * @param statement - * @param parameters String - names separated with space - */ - public void addDeleteStatement(Table table, String statement, String parameters) { - ParametersExtendedImpl parametersExtendedImpl = new ParametersExtendedImpl(); - parametersExtendedImpl.addParameters(ParametersExtendedImpl.getParameters(parameters)); - configWrapper.addDeleteStatement(table, statement, parametersExtendedImpl); - } - - /** - * Add delete statement for a given table - * @param table - * @param statement - * @param parameters - */ - public void addDeleteStatement(Table table, String statement, Parameters parameters) { - configWrapper.addDeleteStatement(table, statement, parameters); - } - - /** - * Add datasource connection information - * @param dataSourceName - */ - public void addConnectionInfo(String dataSourceName) { - configWrapper.addConnectionInfo(dataSourceName, true); - } - - /** - * Add datasource connection information and flag about using managed transactions - * @param dataSourceName - * @param managedtx - */ - public void addConnectionInfo(String dataSourceName, boolean managedtx) { - configWrapper.addConnectionInfo(dataSourceName, managedtx); - } - - /** - * Add driver manager connection information - * @param driverClass - * @param databaseURL - * @param user - * @param password - * @param loginTimeout - */ - public void addConnectionInfo(String driverClass, String databaseURL, String user, String password, int loginTimeout) { - configWrapper.addConnectionInfo(driverClass, databaseURL, user, password, loginTimeout); - } - - /** - * Set the data object model - * @param dataObjectModel - */ - public void setDataObjectModel(String dataObjectModel) { - configWrapper.getConfig().setDataObjectModel(dataObjectModel); - } - - /** - * Add a select command - * @param name - * @param sql - * @return - */ - public Command addSelectCommand(String name, String sql) { - return configWrapper.addCommand(name, sql, "select"); - } - - /** - * Add a update command - * @param name - * @param sql - * @return - */ - public Command addUpdateCommand(String name, String sql) { - return configWrapper.addCommand(name, sql, "update"); - } - - /** - * Add a insert command - * @param name - * @param sql - * @return - */ - public Command addInsertCommand(String name, String sql) { - return configWrapper.addCommand(name, sql, "insert"); - } - - /** - * Add a delete command - * @param name - * @param sql - * @return - */ - public Command addDeleteCommand(String name, String sql) { - return configWrapper.addCommand(name, sql, "delete"); - } - - /** - * Get a reference to the config object - * @return - */ - public Config getConfig() { - return config; - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Converter.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Converter.java deleted file mode 100644 index 24f2e5ee2e..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Converter.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 - */ - 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 - */ - Object getColumnValue(Object propertyData); - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/DAS.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/DAS.java deleted file mode 100644 index 43f1e30d1a..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/DAS.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.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 { - - 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 - */ - 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 - */ - Command getCommand(String name); - - /** - * If the CommandGroup is managing connections then this method must be called - * when the client is done with the instance. - * - */ - void releaseResources(); - - /** - * Creates a Command based on the provided SQL statement - * - * @param sql - * The SQL statement - * @return returns a Command instance - */ - Command createCommand(String sql); - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/DASFactory.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/DASFactory.java deleted file mode 100644 index 313fff225a..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/DASFactory.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 - */ - DAS createDAS(InputStream configStream); - - /** - * Creates a DAS based on the provide config file stream and connection - * @param configStream - * @param connection - * @return - */ - 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 - */ - DAS createDAS(Config config); - - /** - * Creates a DAS based on the provided config and connection - * @param config - * @param connection - * @return - */ - DAS createDAS(Config config, Connection connection); - - /** - * Creates a DAS based on the provided connection - * @param connection - * @return - */ - DAS createDAS(Connection connection); - - -} - diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Pager.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Pager.java deleted file mode 100644 index aa18558fce..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Pager.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 - */ - DataObject next(); - - /** - * Get the page prior to the last page returned - * - * @return the previous page - */ - DataObject previous(); - - /** - * Return a specific identified page. - * - * @param page - * The number of the page to return - * @return the indicated page - */ - DataObject getPage(int page); - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/MappingWrapper.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/MappingWrapper.java deleted file mode 100644 index 6c010b3ee8..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/MappingWrapper.java +++ /dev/null @@ -1,945 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Vector; - -import org.apache.log4j.Logger; -import org.apache.tuscany.das.rdb.config.Column; -import org.apache.tuscany.das.rdb.config.Command; -import org.apache.tuscany.das.rdb.config.Config; -import org.apache.tuscany.das.rdb.config.ConfigFactory; -import org.apache.tuscany.das.rdb.config.ConnectionInfo; -import org.apache.tuscany.das.rdb.config.ConnectionProperties; -import org.apache.tuscany.das.rdb.config.Create; -import org.apache.tuscany.das.rdb.config.Delete; -import org.apache.tuscany.das.rdb.config.KeyPair; -import org.apache.tuscany.das.rdb.config.Parameters; -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 commonj.sdo.Property; - -public class MappingWrapper { - - private static final ConfigFactory FACTORY = ConfigFactory.INSTANCE; - - private final Logger logger = Logger.getLogger(MappingWrapper.class); - - private Config config; - - // TUSCANY-2288 - private List insertOrder; - private List deleteOrder; - private Set rootTableNames; - // -- - - - public MappingWrapper() { - config = FACTORY.createConfig(); - //JIRA-952 - this.checkSchemaNameSupport(); - } - - //JIRA-952 - check if there is any entry with no schemaName when support is ON - public void checkSchemaNameSupport(){ - if(config.isDatabaseSchemaNameSupported()){ - List tableList = config.getTable(); - for(int i=0; itype, if one is available in Config*/ - public Collection getRelationshipsByChildTable(String name) { - Table table = getTableByTypeName(name); - - if(table != null) { - if(config.isDatabaseSchemaNameSupported()) { - name = table.getSchemaName()+"."+table.getTableName(); - } else { - name = table.getTableName(); - } - } - //table can be null, when no in Config and Query based Dynamic Types are used during query - - List 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; - } - - public Set getRootTableNames() { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Getting root tables"); - } - if (rootTableNames == null) { - rootTableNames = new HashSet(); - if (config == null) return rootTableNames; - // parse all relationships - Set allParents = new HashSet(); - Set allChildren = new HashSet(); - Iterator i = getConfig().getRelationship().iterator(); - while (i.hasNext()) { - Relationship r = (Relationship) i.next(); - String parent = r.getPrimaryKeyTable(); - String child = r.getForeignKeyTable(); - if (parent.equals(child)) { - // self-relationship - // do not add to all children list to allow root detection - allParents.add(parent); - } else { - allParents.add(parent); - allChildren.add(child); - } - } - // find roots (depth 0) - // roots are tables that are present in the parents set, but not in the children set - for (Iterator itParents = allParents.iterator(); itParents.hasNext(); ) { - String parent = (String) itParents.next(); - if (!allChildren.contains(parent)) { - rootTableNames.add(parent); - } - } - } - if (this.logger.isDebugEnabled()) { - this.logger.debug(rootTableNames); - } - return rootTableNames; - } - - // TUSCANY-2288 - public List getInsertOrder() { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Getting insert order"); - } - if (insertOrder == null) { - insertOrder = new ArrayList(); - if (config == null) return insertOrder; - // correct insert order: tables sorted by ascending depth - // parse all relationships - Set allParents = new HashSet(); - Set allChildren = new HashSet(); - Map parentToChild = new HashMap(); - Iterator i = getConfig().getRelationship().iterator(); - while (i.hasNext()) { - Relationship r = (Relationship) i.next(); - String parent = r.getPrimaryKeyTable(); - String child = r.getForeignKeyTable(); - if (parent.equals(child)) { - // self-relationship - // do not add to parent to child map to avoid loops - // do not add to all children list to allow root detection - allParents.add(parent); - } else { - allParents.add(parent); - allChildren.add(child); - Set children = (Set) parentToChild.get(parent); - if (children == null) { - children = new HashSet(); - parentToChild.put(parent, children); - } - children.add(child); - } - } - // build list of tables ordered by depth - List depthList = new ArrayList(); - // find roots (depth 0) - // roots are tables that are present in the parents set, but not in the children set - Set roots = new HashSet(); - for (Iterator itParents = allParents.iterator(); itParents.hasNext(); ) { - String parent = (String) itParents.next(); - if (!allChildren.contains(parent)) { - roots.add(parent); - } - } - // traverse table graph to populate depth list - traverseTableGraph(roots, 0, parentToChild, depthList, new ArrayList()); - // build insert order from depth list - for (Iterator itDepths = depthList.iterator(); itDepths.hasNext(); ) { - Set tables = (Set) itDepths.next(); - insertOrder.addAll(tables); - } - } - if (this.logger.isDebugEnabled()) { - this.logger.debug(insertOrder); - } - return insertOrder; - } - - private void traverseTableGraph(Set parents, int parentDepth, Map parentToChild, List depthList, List branch) { - int childDepth = parentDepth + 1; - // expand depth list if necessary - for (int i = depthList.size() - 1; i < parentDepth; i++) { - Set tables = new HashSet(); - depthList.add(tables); - } - // loop thru parents - for (Iterator itParents = parents.iterator(); itParents.hasNext(); ) { - String parent = (String) itParents.next(); - if (branch.contains(parent)) { - // we found a cycle - // we don't handle cycles - // stop traversing branch to avoid infinite loop - break; - } - // add parent to depth list - addTableToDepthList(parent, parentDepth, depthList); - // make recursive call on children - Set children = (Set) parentToChild.get(parent); - if (children != null && children.size() > 0) { - List parentBranch = new ArrayList(); - parentBranch.addAll(branch); - parentBranch.add(parent); - traverseTableGraph(children, childDepth, parentToChild, depthList, parentBranch); - } - } - } - - private void addTableToDepthList(String table, int depth, List depthList) { - // in this method, keep in mind that the same table can appear multiple times at multiple depths inside the table graph - // check if table is already somewhere in depth list - int currentDepth = getTableDepth(table, depthList); - if (currentDepth == -1) { - // table not in depth list - // add it - Set tables = (Set) depthList.get(depth); - tables.add(table); - } else if (currentDepth < depth) { - // table already in depth list, at a lower depth - // the table should only be present once, at the greatest possible depth - // replace table at the new depth - Set tables = (Set) depthList.get(currentDepth); - tables.remove(table); - tables = (Set) depthList.get(depth); - tables.add(table); - } else { - // table already in depth list, at a greater or same depth - // nothing to do, since the table should only be present once, at the greatest possible depth - } - } - - private int getTableDepth(String table, List depthList) { - int depth = -1; - // loop thru depth list - int count = depthList.size(); - for (int i = 0; i < count; i++) { - Set tables = (Set) depthList.get(i); - if (tables != null && tables.contains(table)) { - depth = i; - break; - } - } - return depth; - } - - - public List getDeleteOrder() { - if (deleteOrder == null) { - deleteOrder = new ArrayList(); - deleteOrder.addAll(getInsertOrder()); - Collections.reverse(deleteOrder); - } - return deleteOrder; - } - - // -- - - - //JIRA-952 - public void addConverter(String name, String converter) { - QualifiedColumn column = new QualifiedColumn(name, this.config.isDatabaseSchemaNameSupported()); - Table t = null; - t = findOrCreateTable(column); - 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 Map getConverters(Table table) { - Map 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())) { - if (getTableTypeName(r.getPrimaryKeyTable()).equals(ref.getContainingType().getName())) return r; - } else if(ref.getOpposite().getName().equals(r.getName())) { - if (getTableTypeName(r.getForeignKeyTable()).equals(ref.getContainingType().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 addUpdateStatement(Table table, String statement, Parameters parameters) { - - Update update = ConfigFactory.INSTANCE.createUpdate(); - update.setSql(statement); - update.setParameters(parameters); - table.setUpdate(update); - - } - - public void addDeleteStatement(Table table, String statement, Parameters parameters) { - - Delete delete = ConfigFactory.INSTANCE.createDelete(); - delete.setSql(statement); - delete.setParameters(parameters); - table.setDelete(delete); - - } - - public void addCreateStatement(Table table, String statement, Parameters parameters) { - - Create create = ConfigFactory.INSTANCE.createCreate(); - create.setSql(statement); - create.setParameters(parameters); - table.setCreate(create); - - } - - //JIRA-948 support for driver manager connection - public void addConnectionInfo(String dataSourceName, boolean managedtx){ - ConnectionInfo info = ConfigFactory.INSTANCE.createConnectionInfo(); - info.setDataSource(dataSourceName); - info.setManagedtx(managedtx); - - config.setConnectionInfo(info); - } - - public void addConnectionInfo(String driverClass, String connectionURL, String user, String password, int loginTimeout) { - ConnectionInfo info = ConfigFactory.INSTANCE.createConnectionInfo(); - - ConnectionProperties connectionProperties = ConfigFactory.INSTANCE.createConnectionProperties(); - connectionProperties.setDriverClass(driverClass); - connectionProperties.setDatabaseURL(connectionURL); - connectionProperties.setUserName(user); - connectionProperties.setPassword(password); - connectionProperties.setLoginTimeout(loginTimeout); - - info.setConnectionProperties(connectionProperties); - config.setConnectionInfo(info); - } - //JIRA-948 end - - public Command addCommand(String name, String sql, String kind) { - Command cmd = ConfigFactory.INSTANCE.createCommand(); - cmd.setName(name); - cmd.setKind(kind); - cmd.setSQL(sql); - - config.getCommand().add(cmd); - - return cmd; - } - - //JIRA-952 - public void addImpliedPrimaryKey(String schemaName, String tableName, String columnName) { - Table t = findOrCreateTable(schemaName, tableName);//JIRA-952 - - Iterator i = t.getColumn().iterator(); - boolean hasPK = false; - while (i.hasNext()) { - Column c = (Column) i.next(); - if (c.isPrimaryKey()) { - hasPK = true; - } - } - - if (!hasPK) { - Column c = findOrCreateColumn(t, columnName); - c.setPrimaryKey(true); - } - - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/QualifiedColumn.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/QualifiedColumn.java deleted file mode 100644 index 95e5e78c54..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/QualifiedColumn.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.log4j.Logger; - -public class QualifiedColumn { - - private final String tableName; - - private final String columnName; - private final String schemaName;//JIRA-952 - - private final Logger logger = Logger.getLogger(QualifiedColumn.class); - - public QualifiedColumn(String name) { - this.schemaName = ""; - int index = name.indexOf('.'); - if ( index == -1 ) { - throw new RuntimeException("Column " + name + " must be qualified with a table name"); - } - tableName = name.substring(0, index); - columnName = name.substring(index + 1); - - if (this.logger.isDebugEnabled()) { - this.logger.debug("Table name: " + tableName); - this.logger.debug("Column name: " + columnName); - } - } - - //JIRA-952 - public QualifiedColumn(String name, boolean isDatabaseSchemaNameSupported) { - int index = name.indexOf('.'); - if ( index == -1 ) { - throw new RuntimeException("Column " + name + " must be qualified with a table name and optional schema name"); - } - - int lastIndex = name.lastIndexOf('.'); - - if(index == lastIndex && isDatabaseSchemaNameSupported){ - throw new RuntimeException("Column " + name + " must be qualified with a table name and schema name"); - } - - if(isDatabaseSchemaNameSupported){ - schemaName = name.substring(0, index); - tableName = name.substring(index+1, lastIndex); - columnName = name.substring(lastIndex + 1); - } - else{ - schemaName = ""; - tableName = name.substring(0, index); - columnName = name.substring(index + 1); - } - - if (this.logger.isDebugEnabled()) { - this.logger.debug("Table name: " + tableName); - this.logger.debug("Column name: " + columnName); - } - } - public String getTableName() { - return this.tableName; - } - - //JIRA-952 - public String getSchemaName() { - return this.schemaName; - } - public String getColumnName() { - return this.columnName; - } - //JIRA-952 - public String toString(){ - if(this.schemaName == null || this.schemaName.equals("")) - return this.tableName+"."+this.columnName; - else - return this.schemaName+"."+this.tableName+"."+this.columnName; - } -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/RelationshipWrapper.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/RelationshipWrapper.java deleted file mode 100644 index af2ab7ca5b..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/RelationshipWrapper.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.List; - -import org.apache.tuscany.das.rdb.config.KeyPair; -import org.apache.tuscany.das.rdb.config.Relationship; - -public class RelationshipWrapper { - - private Relationship relationship; - private List foreignKeys; - - public RelationshipWrapper(Relationship r) { - this.relationship = r; - } - - public Collection getForeignKeys() { - if (foreignKeys == null) { - foreignKeys = new ArrayList(); - Iterator i = this.relationship.getKeyPair().iterator(); - while (i.hasNext()) { - KeyPair pair = (KeyPair) i.next(); - foreignKeys.add(pair.getForeignKeyColumn()); - } - } - return foreignKeys; - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/TableWrapper.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/TableWrapper.java deleted file mode 100644 index ef420eedf2..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/TableWrapper.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.List; - -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 String getTableName() { - return table.getTableName(); - } - - public Collection getPrimaryKeyNames() { - List 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() { - - List 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(); - } - - 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(); - } - return c.getColumnName(); - - } - - public String getManagedColumnPropertyName() { - Iterator i = table.getColumn().iterator(); - while (i.hasNext()) { - Column c = (Column) i.next(); - if (c.isCollision() && c.isManaged()) { - return c.getPropertyName() == null ? c.getColumnName() : c.getPropertyName(); - } - } - return null; - - } - - public Column getManagedColumn() { - Iterator i = table.getColumn().iterator(); - while (i.hasNext()) { - Column c = (Column) i.next(); - if (c.isCollision() && c.isManaged()) { - return c; - } - } - return null; - } -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/exception/DataSourceInitializationException.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/exception/DataSourceInitializationException.java deleted file mode 100644 index 6a644b7ed9..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/exception/DataSourceInitializationException.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.exception; - -public class DataSourceInitializationException extends RuntimeException { - - private static final long serialVersionUID = 302160989411041041L; - - public DataSourceInitializationException(String string) { - super(string); - } - - public DataSourceInitializationException(Throwable e){ - super(e); - } - - public DataSourceInitializationException(String string, Throwable e) { - super(string, e); - } -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/exception/OptimisticConcurrencyException.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/exception/OptimisticConcurrencyException.java deleted file mode 100644 index dc64d7dc94..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/exception/OptimisticConcurrencyException.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.exception; - - -public class OptimisticConcurrencyException extends RuntimeException { - - private static final long serialVersionUID = -8430445422807942933L; - - public OptimisticConcurrencyException(String string) { - super(string); - } - - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/BaseGenerator.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/BaseGenerator.java deleted file mode 100644 index 05d97723a7..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/BaseGenerator.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 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/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/DeleteGenerator.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/DeleteGenerator.java deleted file mode 100644 index ad2a90c841..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/DeleteGenerator.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.log4j.Logger; -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.DeleteCommandImpl; -import org.apache.tuscany.das.rdb.impl.ParameterExtendedImpl; -import org.apache.tuscany.das.rdb.impl.SDODataTypeHelper; -import org.apache.tuscany.das.rdb.impl.SDODataTypes; - -public final class DeleteGenerator extends BaseGenerator { - - public static final DeleteGenerator INSTANCE = new DeleteGenerator(); - - private final Logger logger = Logger.getLogger(DeleteGenerator.class); - - private DeleteGenerator() { - super(); - } - - //JIRA-952 - private String getDeleteStatement(MappingWrapper mapping, Table t) { - TableWrapper table = new TableWrapper(t); - - StringBuffer statement = new StringBuffer(); - statement.append("delete from "); - if(mapping.getConfig().isDatabaseSchemaNameSupported()){ - statement.append(t.getSchemaName()+"."+t.getTableName()); - } - else{ - 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 "); - } - } - - if (this.logger.isDebugEnabled()) { - this.logger.debug(statement.toString()); - } - - return statement.toString(); - } - - public DeleteCommandImpl getDeleteCommand(MappingWrapper mapping, Table t) { - TableWrapper tw = new TableWrapper(t); - DeleteCommandImpl deleteCommand = new DeleteCommandImpl(getDeleteStatement(mapping, t)); - - Iterator i = tw.getPrimaryKeyProperties().iterator(); - for (int idx = 1; i.hasNext(); idx++) { - String property = (String) i.next(); - ParameterExtendedImpl p = new ParameterExtendedImpl(); - p.setName(property); - p.setColumnType(SDODataTypeHelper.columnTypeForSDOType(SDODataTypes.OBJECT)); - p.setConverter(getConverter(tw.getConverter(property))); - p.setIndex(idx); - deleteCommand.addParameter(p); - } - return deleteCommand; - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/InsertGenerator.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/InsertGenerator.java deleted file mode 100644 index d174629ad9..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/InsertGenerator.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.HashSet; -import java.util.Iterator; -import java.util.List; - -import org.apache.log4j.Logger; -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.impl.InsertCommandImpl; -import org.apache.tuscany.das.rdb.impl.ParameterExtendedImpl; -import org.apache.tuscany.das.rdb.impl.SDODataTypeHelper; -import org.apache.tuscany.das.rdb.util.CollectionsUtil; - -import commonj.sdo.DataObject; -import commonj.sdo.Property; - -public final class InsertGenerator extends BaseGenerator { - - public static final InsertGenerator INSTANCE = new InsertGenerator(); - - private final Logger logger = Logger.getLogger(InsertGenerator.class); - - private InsertGenerator() { - super(); - } - - public InsertCommandImpl getInsertCommand(MappingWrapper config, DataObject changedObject, Table t) { - List parameters = new ArrayList(); - TableWrapper table = new TableWrapper(t); - StringBuffer statement = new StringBuffer("insert into "); - //JIRA-952 - if(config.getConfig().isDatabaseSchemaNameSupported()){ - statement.append(t.getSchemaName()+"."+t.getTableName()); - } - else{ - statement.append(t.getTableName()); - } - HashSet changedProperties = getAttributeProperties(changedObject, config, table); - Iterator i; - if ( changedProperties.isEmpty() ) { - i = changedObject.getType().getProperties().iterator(); - } else { - i = changedProperties.iterator(); - } - - List attributes = new ArrayList(); - List generatedKeys = new ArrayList(); - while (i.hasNext()) { - Property attr = (Property) i.next(); - if ( attr.getType().isDataType()) { - if (table.isGeneratedColumnProperty(attr.getName())) { - generatedKeys.add(attr.getName()); - } else { - 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(""); - Column c = config.getColumnByPropertyName(t, name); - statement.append(c == null ? name : c.getColumnName()); - 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(), - (String[]) generatedKeys.toArray(new String[0])); - Iterator params = parameters.iterator(); - for (int idx = 1; params.hasNext(); idx++) { - Property property = (Property) params.next(); - ParameterExtendedImpl p = new ParameterExtendedImpl(); - p.setName(property.getName()); - p.setType(property.getType()); - p.setColumnType(SDODataTypeHelper.columnTypeForSDOType(property.getType())); - p.setConverter(getConverter(table.getConverter(property.getName()))); - p.setIndex(idx); - cmd.addParameter(p); - - } - if (this.logger.isDebugEnabled()) { - this.logger.debug(statement.toString()); - } - - return cmd; - - } - - private HashSet getAttributeProperties(DataObject obj, MappingWrapper config, TableWrapper tw) { - HashSet fields = new HashSet(); - Iterator i = obj.getType().getProperties().iterator(); - while (i.hasNext()) { - Property p = (Property) i.next(); - if (p.getType().isDataType()) { - if (obj.isSet(p)) { - if (fields.add(p) == false) { - throw new RuntimeException("Foreign key properties should not be set when the corrsponding relationship has changed"); - } - } - } else { - if (obj.isSet(p)) { - Relationship relationship = config.getRelationshipByReference(p); - if ((p.getOpposite() != null && p.getOpposite().isMany()) - || (hasState(tw, relationship, obj))) { - RelationshipWrapper r = new RelationshipWrapper(relationship); - Iterator keys = r.getForeignKeys().iterator(); - while (keys.hasNext()) { - String key = (String) keys.next(); - String keyProperty = config.getColumnPropertyName(tw.getTableName(), key); - Property keyProp = obj.getType().getProperty(keyProperty); - if ( keyProp == null ) - throw new RuntimeException("Invalid foreign key column: " + key); - if (fields.add(keyProp) == false) { - throw new RuntimeException("Foreign key properties should not be set when the corresponding relationship has changed"); - } - } - } - - } - } - } - - return fields; - - } - - private boolean hasState(TableWrapper tw, Relationship rel, DataObject changedObject) { - - if (!rel.isMany()) { - - RelationshipWrapper rw = new RelationshipWrapper(rel); - if ((rel.getForeignKeyTable().equals(tw.getTableName())) - && (CollectionsUtil.disjoint(tw.getPrimaryKeyProperties(), rw.getForeignKeys()))) { - return true; - } - } - - return false; - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/UpdateGenerator.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/UpdateGenerator.java deleted file mode 100644 index d74d3f413f..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/UpdateGenerator.java +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.HashSet; -import java.util.Iterator; -import java.util.List; - -import org.apache.log4j.Logger; -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.impl.CollisionParameter; -import org.apache.tuscany.das.rdb.impl.ManagedParameterImpl; -import org.apache.tuscany.das.rdb.impl.OptimisticWriteCommandImpl; -import org.apache.tuscany.das.rdb.impl.ParameterExtendedImpl; -import org.apache.tuscany.das.rdb.impl.SDODataTypeHelper; -import org.apache.tuscany.das.rdb.impl.UpdateCommandImpl; -import org.apache.tuscany.das.rdb.util.CollectionsUtil; - -import commonj.sdo.ChangeSummary; -import commonj.sdo.DataObject; -import commonj.sdo.Property; -import commonj.sdo.Type; -import commonj.sdo.ChangeSummary.Setting; - -public final class UpdateGenerator extends BaseGenerator { - - public static final UpdateGenerator INSTANCE = new UpdateGenerator(); - - private final Logger logger = Logger.getLogger(UpdateGenerator.class); - - private UpdateGenerator() { - super(); - } - - /*Utility to check if the given HashSet of Properties contains a property with certain name*/ - private boolean isContained(HashSet changedFields, String propertyName) { - Iterator itr = changedFields.iterator(); - while(itr.hasNext()) { - Property changedProperty = (Property)itr.next(); - if(changedProperty.getName().equals(propertyName)) { - return true; - } - } - return false; - } - - public UpdateCommandImpl getUpdateCommand(MappingWrapper mapping, DataObject changedObject, Table table) { - List parameters = new ArrayList(); - Type type = changedObject.getType(); - TableWrapper tableWrapper = new TableWrapper(table); - // get changed fields - ChangeSummary summary = changedObject.getDataGraph().getChangeSummary(); - HashSet changedFields = getChangedFields(mapping, summary, changedObject, tableWrapper); - // if there are no changed fields return null - if (changedFields.size() == 0) { - return null; - } - // compose statement - StringBuffer statement = new StringBuffer("update "); - if(mapping.getConfig().isDatabaseSchemaNameSupported()){ - statement.append(table.getSchemaName()+"."+table.getTableName()); - } - else{ - statement.append(table.getTableName()); - } - statement.append(" set "); - - Iterator i = changedFields.iterator(); - - int idx = 1; - while (i.hasNext()) { - Property property = (Property) i.next(); - Column c = tableWrapper.getColumnByPropertyName(property.getName()); - - if ((c == null) || !c.isCollision() || !c.isPrimaryKey()) { - String columnName = c == null ? property.getName() : c.getColumnName(); - appendFieldSet(statement, idx > 1, columnName); - parameters.add(createParameter(tableWrapper, property, idx++)); - } - } - - Column c = tableWrapper.getManagedColumn(); - if (c != null) { - appendFieldSet(statement, idx > 1, c.getColumnName()); - String propertyName = c.getPropertyName() == null ? c.getColumnName() : c.getPropertyName(); - parameters.add(createManagedParameter(tableWrapper, - changedObject.getInstanceProperty(propertyName), idx++)); - } - - statement.append(" where "); - - Iterator pkColumnNames = tableWrapper.getPrimaryKeyNames().iterator(); - Iterator pkPropertyNames = tableWrapper.getPrimaryKeyProperties().iterator(); - while (pkColumnNames.hasNext() && pkPropertyNames.hasNext()) { - String columnName = (String) pkColumnNames.next(); - String propertyName = (String) pkPropertyNames.next(); - - if(!isContained(changedFields, propertyName)) {//if PK itself is changed, don't add here, will get added below as collision parameter - statement.append(columnName); - statement.append(" = ?"); - if (pkColumnNames.hasNext() && pkPropertyNames.hasNext()) { - statement.append(" and "); - } - parameters.add(createParameter(tableWrapper, type.getProperty(propertyName), idx++)); - } - } - - if (tableWrapper.getCollisionColumn() == null) { - Iterator iter = changedFields.iterator(); - while (iter.hasNext()) { - if(statement.lastIndexOf(" where ") != statement.length()-7) - statement.append(" and "); - - Property changedProperty = (Property) iter.next(); - Column column = tableWrapper.getColumnByPropertyName(changedProperty.getName()); - statement.append(column == null ? changedProperty.getName() : column.getColumnName()); - - Object value; - Setting setting = summary.getOldValue(changedObject, changedProperty); - // Setting is null if this is a relationship change - if (setting == null) { - value = changedObject.get(changedProperty); - } else { - value = setting.getValue(); - } - - if (value == null) { - statement.append(" is null"); - } else { - ParameterExtendedImpl param = createCollisionParameter(tableWrapper, changedProperty, idx++); - statement.append(" = ?"); - param.setValue(value); - parameters.add(param); - } - - - } - - } else { - if(statement.lastIndexOf(" where ") != statement.length()-7) - statement.append(" and "); - - statement.append(tableWrapper.getCollisionColumn().getColumnName()); - statement.append(" = ?"); - parameters.add(createParameter(tableWrapper, - type.getProperty(tableWrapper.getCollisionColumnPropertyName()), idx++)); - } - - UpdateCommandImpl updateCommand = new OptimisticWriteCommandImpl(statement.toString()); - - Iterator params = parameters.iterator(); - while (params.hasNext()) { - ParameterExtendedImpl ptemp = (ParameterExtendedImpl) params.next(); - updateCommand.addParameter(ptemp); - } - - if (this.logger.isDebugEnabled()) { - this.logger.debug(statement.toString()); - } - - return updateCommand; - } - - - - private void appendFieldSet(StringBuffer statement, boolean appendComma, String columnName) { - if (appendComma) { - statement.append(", "); - } - statement.append(columnName); - statement.append(" = ?"); - } - - - - private HashSet getChangedFields(MappingWrapper config, ChangeSummary summary, DataObject obj, TableWrapper tw) { - HashSet changes = new HashSet(); - - Iterator i = summary.getOldValues(obj).iterator(); - while (i.hasNext()) { - ChangeSummary.Setting setting = (ChangeSummary.Setting) i.next(); - - if (setting.getProperty().getType().isDataType()) { - if ( changes.add(setting.getProperty()) == false ) { - throw new RuntimeException("Foreign key properties should not be set when the corresponding relationship has changed"); - } - } else { - Property ref = setting.getProperty(); - - Relationship relationship = config.getRelationshipByReference(ref); - if ((ref.getOpposite() != null && ref.getOpposite().isMany()) - || (hasState(tw, relationship, obj))) { - RelationshipWrapper r = new RelationshipWrapper(config.getRelationshipByReference(ref)); - - Iterator keys = r.getForeignKeys().iterator(); - while (keys.hasNext()) { - String key = (String) keys.next(); - String keyProperty = config.getColumnPropertyName(tw.getTableName(), key); - Property keyProp = obj.getType().getProperty(keyProperty); - if ( keyProp == null ) { - throw new RuntimeException("Invalid foreign key column: " + key); - } - if (changes.add(keyProp) == false) { - throw new RuntimeException("Foreign key properties should not be set when the corresponding relationship has changed"); - } - } - } - } - } - return changes; - } - - private boolean hasState(TableWrapper tw, Relationship rel, DataObject changedObject) { - if (!rel.isMany()) { - RelationshipWrapper rw = new RelationshipWrapper(rel); - if ((rel.getForeignKeyTable().equals(tw.getTableName())) - && (CollectionsUtil.disjoint(tw.getPrimaryKeyProperties(), rw.getForeignKeys()))) { - return true; - } - } - - return false; - } - - private ParameterExtendedImpl fillExtendedParameter(ParameterExtendedImpl param, TableWrapper table, Property property, int idx) { - param.setName(property.getName()); - param.setType(property.getType()); - param.setConverter(getConverter(table.getConverter(property.getName()))); - if (idx != -1) { - param.setIndex(idx); - } - param.setColumnType(SDODataTypeHelper.columnTypeForSDOType(property.getType())); - return param; - } - private ParameterExtendedImpl createCollisionParameter(TableWrapper tableWrapper, Property property, int i) { - ParameterExtendedImpl param = new CollisionParameter(); - return fillExtendedParameter(param, tableWrapper, property, i); - } - - private ParameterExtendedImpl createManagedParameter(TableWrapper table, Property property, int idx) { - ParameterExtendedImpl param = new ManagedParameterImpl(); - return fillExtendedParameter(param, table, property, idx); - } - - private ParameterExtendedImpl createParameter(TableWrapper table, Property property, int idx) { - ParameterExtendedImpl param = new ParameterExtendedImpl(); - return fillExtendedParameter(param, table, property, idx); - } -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java deleted file mode 100644 index 0e5fc48c0c..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.apache.log4j.Logger; - -import commonj.sdo.DataObject; -import commonj.sdo.Property; -import commonj.sdo.Type; -import commonj.sdo.helper.DataFactory; - -public final class DataObjectMaker { - - private final DataObject rootObject; - private final Map containmentPropertyMap; - private final Map typeMap; - - private static final Logger logger = Logger.getLogger(DataObjectMaker.class); - - public DataObjectMaker(DataObject root) { - this.rootObject = root; - containmentPropertyMap = new HashMap(); - typeMap = new HashMap(); - Iterator i = this.rootObject.getType().getProperties().iterator(); - while (i.hasNext()) { - Property p = (Property) i.next(); - Type type = p.getType(); - String typeName = type.getName(); - typeMap.put(typeName, type); - if (p.isContainment()) { - containmentPropertyMap.put(typeName, p); - } - } - } - - /** - * @param tableData - * @return - */ - public DataObject createAndAddDataObject(TableData tableData, ResultMetadata resultMetadata) { - // Get a Type from the package and create a standalone DataObject - - if (this.logger.isDebugEnabled()) { - this.logger.debug("Looking for Type for " + tableData.getTableName()); - } - - String tableName = tableData.getTableName(); - Type tableClass = (Type) typeMap.get(tableName); - - 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 - Property containmentProp = (Property) containmentPropertyMap.get(tableName); - if (containmentProp != null) { - if (containmentProp.isMany()) { - rootObject.getList(containmentProp).add(obj); - } else { - this.rootObject.set(containmentProp, obj); - } - } - - // Set the column values - Iterator columnNames = resultMetadata.getPropertyNames(tableData.getTableName()).iterator(); - Type objType = obj.getType(); - while (columnNames.hasNext()) { - String propertyName = (String) columnNames.next(); - Property p = objType.getProperty(propertyName); - if (p == null) { - // Try again, ignoring case - p = findProperty(objType, propertyName); - if (p == null) { - throw new RuntimeException("Type " + obj.getType().getName() - + " does not contain a property named " + propertyName); - } - } - - Object value = tableData.getColumnData(propertyName); - - 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; - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DefaultConverter.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DefaultConverter.java deleted file mode 100644 index a08f184b9a..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DefaultConverter.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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); - } - } - - return data; - - } -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/GraphBuilderMetadata.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/GraphBuilderMetadata.java deleted file mode 100644 index 5be56d77d8..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/GraphBuilderMetadata.java +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; -import org.apache.tuscany.das.rdb.config.Config; -import org.apache.tuscany.das.rdb.config.Relationship; -import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; -import org.apache.tuscany.das.rdb.impl.ResultSetShape; -import org.apache.tuscany.sdo.api.SDOUtil; - -import commonj.sdo.Property; -import commonj.sdo.Type; -import commonj.sdo.helper.HelperContext; -import commonj.sdo.impl.HelperProvider; - -/** - */ -public final class GraphBuilderMetadata { - - private static final Logger logger = Logger.getLogger(GraphBuilderMetadata.class); - - private MappingWrapper configWrapper; - - private final Collection resultSets = new ArrayList(); - - private String typeURI; - - private List definedTypes; - - private Type rootType; - - private HelperContext defaultHelperContext = HelperProvider.getDefaultContext(); - private HelperContext helperContext = HelperProvider.getInstance().getDefaultContext(); - - - public GraphBuilderMetadata(List results, Config model, ResultSetShape shape) throws SQLException { - this.configWrapper = new MappingWrapper(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, configWrapper, shape); - resultSets.add(resultMetadata); - } - - } - - /** - * Returns the collection of ResultMetadata objects - */ - public Collection getResultMetadata() { - return this.resultSets; - } - - /** - * Returns the set of defined relationships - */ - - public Collection getRelationships() { - return configWrapper.getConfig().getRelationship(); - } - - /** - * Returns the root Type - */ - public Type getRootType() { - if (this.rootType == null) { - if (this.typeURI == null) { - createDynamicTypes(); - } else { - createDynamicRoot(); - } - } - - return this.rootType; - } - - public MappingWrapper getConfigWrapper() { - return this.configWrapper; - } - - /** - * Creates a set of SDO Types based on the query results and supplied config information - */ - - private void createDynamicTypes() { - - Type root = SDOUtil.createType(helperContext, getDefaultURI(), "DataGraphRoot", false); - if (this.logger.isDebugEnabled()) { - this.logger.debug("GBMD.createDynamicTypes():created Type for "+getDefaultURI()); - } - - Iterator iter = 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(); - if (root.getProperty(tableName) == null) { - Type tableType = SDOUtil.createType(helperContext, getDefaultURI(), tableName, false); - Property property = SDOUtil.createProperty(root, tableName, tableType); - SDOUtil.setMany(property, true); - SDOUtil.setContainment(property, true); - if (this.logger.isDebugEnabled()) { - this.logger.debug("GBMD.createDynamicTypes():CREATING NEW TABLE TYPE & PROPERTY :"+tableName); - } - } - } - - // TODO tablePropertyMap is temporary until Tuscany-203 is fixed - Map tablePropertyMap = new HashMap(); - - for (int i = 1; i <= resultMetadata.getResultSetSize(); i++) { - - Property ref = root.getProperty(resultMetadata.getTablePropertyName(i)); - - if (ref == null) { - throw new RuntimeException("Could not find table " + resultMetadata.getTablePropertyName(i) - + " in the SDO model"); - } - - // TODO Temporary code to check to see if a property has already been added. - // Replace when Tuscany-203 is fixed - List addedProperties = (List) tablePropertyMap.get(ref.getName()); - if (addedProperties == null) { - addedProperties = new ArrayList(); - tablePropertyMap.put(ref.getName(), addedProperties); - } - - - - 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); - - } - - } - } - - MappingWrapper wrapper = getConfigWrapper(); - Iterator i = 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 = root.getProperty(parentName); - Property childProperty = root.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()); - } - - this.rootType = root; - } - - private String getDefaultURI() { - return "http:///org.apache.tuscany.das.rdb/das"; - } - - /** - * Create a dynamic root Type to act as a container Type for a set of generated Types - * - */ - private void createDynamicRoot() { - Type root = SDOUtil.createType(helperContext, getDefaultURI() + "/DataGraphRoot", "DataGraphRoot", false); - - List types = getDefinedTypes(); - - if (types == null) { - throw new RuntimeException("SDO Types have not been registered for URI " + typeURI); - } - - Iterator i = types.iterator(); - while (i.hasNext()) { - Type type = (Type) i.next(); - Property property = SDOUtil.createProperty(root, type.getName(), type); - SDOUtil.setContainment(property, true); - SDOUtil.setMany(property, true); - } - this.rootType = root; - } - - public List getDefinedTypes() { - if (this.definedTypes == null) { - List types = null; - List defaultTypes = null; - if (this.typeURI == null) { - types = SDOUtil.getTypes(helperContext, getDefaultURI()); - defaultTypes = SDOUtil.getTypes(defaultHelperContext, getDefaultURI()); - if(defaultTypes != null){ - if(types == null) { - types = defaultTypes; - } - else { - types.addAll(defaultTypes); - } - } - this.definedTypes = types; - } else { - types = SDOUtil.getTypes(helperContext, typeURI); - defaultTypes = SDOUtil.getTypes(defaultHelperContext, typeURI); - if(defaultTypes != null){ - if(types == null) { - types = defaultTypes; - } - else { - types.addAll(defaultTypes); - } - } - - if(rootType != null) - types.add(rootType); - this.definedTypes = types; - } - } - return this.definedTypes; - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/MultiTableRegistry.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/MultiTableRegistry.java deleted file mode 100644 index bc3ca440b9..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/MultiTableRegistry.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.Map; - -import org.apache.log4j.Logger; - -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 static final Logger logger = Logger.getLogger(MultiTableRegistry.class); - - private Map tableNameMap; - - private Map tableValueMap; - - 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 (this.logger.isDebugEnabled()) { - this.logger.debug("Looking for table " + tableName + " with PK " + primaryKey); - this.logger.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 Map getPkMap(String tableName) { - Map 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; - - } - - public void remove(String tableName, List primaryKey) { - getPkMap(tableName).get(primaryKey); - Map pkMap = (HashMap) tableNameMap.get(tableName); - - if(pkMap.get(primaryKey) != null) { - pkMap.remove(primaryKey); - } - - if(pkMap.size() == 0) { - tableNameMap.remove(tableName); - } - } -} \ No newline at end of file diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java deleted file mode 100644 index 39f35150ec..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java +++ /dev/null @@ -1,411 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -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.impl.SDODataTypes; - -import commonj.sdo.Type; - -public final class ResultMetadata { - - private Map tableToPropertyMap = new HashMap(); - - private List typeNames = new ArrayList(); - - private List propertyNames = new ArrayList(); - - private final ResultSet resultSet; - - private final ResultSetShape resultSetShape; - - private final MappingWrapper configWrapper; - - private Converter[] converters; - - private Map tableToPrimaryKeysMap = new HashMap(); - - //JIRA-952 - public ResultMetadata(ResultSet rs, MappingWrapper cfgWrapper, ResultSetShape shape) throws SQLException { - - this.resultSet = rs; - this.configWrapper = cfgWrapper; - - if (shape == null) { - this.resultSetShape = new ResultSetShape(rs.getMetaData(), configWrapper.getConfig()); - } else { - this.resultSetShape = shape; - } - - this.converters = new Converter[resultSetShape.getColumnCount()]; - - Map impliedRelationships = new HashMap(); - String schemaName = ""; - String idSpell = null; - for (int i = 1; i <= resultSetShape.getColumnCount(); i++) { - String tableName = resultSetShape.getTableName(i); - schemaName = resultSetShape.getSchemaName(i); - if (( tableName == null ) || ( tableName.equals(""))) { - throw new RuntimeException("Unable to obtain table information from JDBC. DAS configuration must specify ResultDescriptors"); - } - String typeName = null; - - if(this.configWrapper.getConfig().isDatabaseSchemaNameSupported()){ - typeName = configWrapper.getTableTypeName(schemaName+"."+tableName); - } - else{ - typeName = configWrapper.getTableTypeName(tableName); - } - String columnName = resultSetShape.getColumnName(i); - - String colName = ""; - if (columnName.regionMatches(true, columnName.length()-3, "_ID", 0, 3)) { - idSpell = columnName.substring(columnName.length()-3, columnName.length()); - if(this.configWrapper.getConfig().isDatabaseSchemaNameSupported()){ - colName = schemaName+"."+columnName; - impliedRelationships.put(colName, schemaName+"."+tableName); - } - else{ - colName = columnName; - impliedRelationships.put(colName, tableName); - } - } else if (columnName.equalsIgnoreCase("ID")) { - configWrapper.addImpliedPrimaryKey(schemaName, tableName, columnName); - } - - String propertyName = null; - - if(this.configWrapper.getConfig().isDatabaseSchemaNameSupported()){ - propertyName = configWrapper.getColumnPropertyName(schemaName+"."+tableName, columnName); - } - else{ - propertyName = configWrapper.getColumnPropertyName(tableName, columnName); - } - String converterName = null; - - if(this.configWrapper.getConfig().isDatabaseSchemaNameSupported()){ - converterName = configWrapper.getConverter(schemaName+"."+tableName, resultSetShape.getColumnName(i)); - } - else{ - converterName = configWrapper.getConverter(tableName, resultSetShape.getColumnName(i)); - } - - converters[i - 1] = loadConverter(converterName, resultSetShape.getColumnType(i)); - - typeNames.add(typeName); - propertyNames.add(propertyName); - - Collection properties = (Collection) tableToPropertyMap.get(typeName); - if (properties == null) { - properties = new ArrayList(); - } - properties.add(propertyName); - tableToPropertyMap.put(typeName, properties); - - } - - //System.out.println("tableToPropertyMap "+tableToPropertyMap); - fillTableToPrimaryKeysMap(); - - Iterator i = impliedRelationships.keySet().iterator(); - while (i.hasNext()) { - String columnName = (String) i.next(); - String pkTableName = columnName.substring(0, columnName.indexOf(idSpell));//_id, _Id, _iD, _ID anything - String fkTableName = (String) impliedRelationships.get(columnName); - List pkTableProperties = (List) tableToPropertyMap.get(configWrapper.getTableTypeName(pkTableName)); - if ((pkTableProperties != null) && (pkTableProperties.contains("ID"))) { - configWrapper.addImpliedRelationship(pkTableName, fkTableName, columnName); - } - } - // Add any tables defined in the model but not included in the ResultSet - // to the list of propertyNames - Config model = configWrapper.getConfig(); - if (model != null) { - Iterator tablesFromModel = model.getTable().iterator(); - while (tablesFromModel.hasNext()) { - TableWrapper t = new TableWrapper((Table) tablesFromModel.next()); - if (tableToPropertyMap.get(t.getTypeName()) == null) { - tableToPropertyMap.put(t.getTypeName(), Collections.EMPTY_LIST); - } - } - } - } - - //Now fill tableToPrimaryKeysMap.Complete for whichever tables are there in tableToPrimaryKeysMap, - //Also case of implied PK and it is not there in SELECT, provide way to still fill it in - //tableToPrimaryKeysMap - the column should be present in Config (though not defed as PK) - //And consider the classic case, when we assume all columns to be PKs - when no info - //in config for table or "all columns" - private void fillTableToPrimaryKeysMap(){ - Iterator itr = tableToPropertyMap.keySet().iterator(); - while(itr.hasNext()){ - String curTableName = (String)itr.next(); - boolean treatAllPKs = false;//flag for, when all cols need to be treated as PKs - - if(tableToPrimaryKeysMap.containsKey(curTableName)){ - continue;//don't keep refilling same hashset for each ResultMetadata constructor, - } - - List columnsForTable = null; - if(configWrapper.getTableByTypeName(curTableName) != null) { - columnsForTable = configWrapper.getTableByTypeName(curTableName).getColumn(); - } - else if(configWrapper.getTable(curTableName) != null){ - columnsForTable = configWrapper.getTable(curTableName).getColumn(); - configWrapper.getTable(curTableName).setTypeName(curTableName);//keep configWrapper consistent with Type info - } - else{ - treatAllPKs = true;//can not find table/type, need to consider all columns as PKs - } - - if(columnsForTable != null){ - for(int ii=0; ii 0); - this.resultSetSize = m.getResultSetSize(); - cacheMetadata(); - getAllTableNamesForRS(); - getTablesWithNoPK(); - } - - /** - * Processes a single row in the ResultSet. - * - * @param rs - * A ResultSet positioned on the desired row - */ - public final void processRow(ResultSet rs) throws SQLException { - // clear previous data - for (Iterator itTableData = allTableData.iterator(); itTableData.hasNext(); ) { - TableData tableData = (TableData) itTableData.next(); - tableData.clear(); - } - allTableData = new ArrayList(); - // set current resultSet - currentResultSet = rs; - // process row - if (recursive) { - processRecursiveRow(); - } else { - processNonRecursiveRow(); - } - } - - public final TableData processRowForTable(String tablePropertyName) throws SQLException { - int[] indexes = (int[]) indexesByTablePropertyName.get(tablePropertyName); - TableData table = getRawData(tablePropertyName); - int count = indexes.length; - for (int j = 0; j < count; j++) { - int i = indexes[j]; - if (!isPKColumn[i]) { - // skipping primary key columns since they've already been processed by processRow() - Object data = getObject(currentResultSet, i); - if (this.logger.isDebugEnabled()) { - this.logger.debug("Adding column: " + columnPropertyNames[i] + "\tValue: " - + data + "\tTable: " - + tablePropertyNames[i]); - } - table.addData(columnPropertyNames[i], false, data); - } - } - return table; - } - - private void processNonRecursiveRow() throws SQLException { - // parse primary keys only - // the rest will be parsed as needed - int count = indexesForPKs.length; - for (int j = 0; j < count; j++) { - int i = indexesForPKs[j]; - Object data = getObject(currentResultSet, i); - if (data == null) { - // primary key is null, check other columns - String tablePropertyName = tablePropertyNames[i]; - // if table data already exists then this has already been done - if (!tableMap.containsKey(tablePropertyName)) { - TableData table = getRawData(tablePropertyName); - processRowForTable(tablePropertyName); - // add table data only if not empty - if (!table.isTableEmpty()) { - table.addData(columnPropertyNames[i], true, data); - allTableData.add(table); - } - } - } else { - // add table data - TableData table = getRawData(tablePropertyNames[i]); - if (!allTableData.contains(table)) allTableData.add(table); - if (this.logger.isDebugEnabled()) { - this.logger.debug("Adding column: " + columnPropertyNames[i] + "\tValue: " - + data + "\tTable: " - + tablePropertyNames[i]); - } - table.addData(columnPropertyNames[i], true, data); - } - } - checkResultSetMissesPK(); - } - - //get all table names involved in current result set - //can not use metadata.getAllTablePropertyNames() - //as it gives table names for all tables from Config - private void getAllTableNamesForRS(){ - allTableNames = new HashSet(resultSetSize); - for (int i = 1; i <= resultSetSize; i++) { - allTableNames.add(tablePropertyNames[i]); - } - } - - private void cacheMetadata() { - tablePropertyNames = new String[resultSetSize + 1]; - columnPropertyNames = new String[resultSetSize + 1]; - isPKColumn = new boolean[resultSetSize + 1]; - String tablePropertyName = null; - boolean isPK; - List pkColumnList = new ArrayList(); - // loop thru indexes - for (int i = 1; i <= resultSetSize; i++) { - columnPropertyNames[i] = metadata.getColumnPropertyName(i); - tablePropertyName = metadata.getTablePropertyName(i); - tablePropertyNames[i] = tablePropertyName; - List indexes = (List) indexesByTablePropertyName.get(tablePropertyName); - if (indexes == null) { - indexes = new ArrayList(); - indexesByTablePropertyName.put(tablePropertyName, indexes); - } - indexes.add(new Integer(i)); - isPK = metadata.isPKColumn(i); - isPKColumn[i] = isPK; - if (isPK) { - pkColumnList.add(new Integer(i)); - } - } - // reorganize indexes by table property name - for (Iterator itTablePropertyNames = indexesByTablePropertyName.keySet().iterator(); itTablePropertyNames.hasNext(); ) { - tablePropertyName = (String) itTablePropertyNames.next(); - List indexes = (List) indexesByTablePropertyName.get(tablePropertyName); - int count = indexes.size(); - int[] indexArray = new int[count]; - for (int i = 0; i < count; i++) { - indexArray[i] = ((Integer) indexes.get(i)).intValue(); - } - indexesByTablePropertyName.put(tablePropertyName, indexArray); - } - // reorganize indexes for PKs - int count = pkColumnList.size(); - indexesForPKs = new int[count]; - for (int i = 0; i < count; i++) { - indexesForPKs[i] = ((Integer) pkColumnList.get(i)).intValue(); - } - } - - private void getTablesWithNoPK(){ - //case when result set omits PK column, take care of compound PKs too - boolean tableRSHasPK; - Iterator itr = allTableNames.iterator(); - while(itr.hasNext()){ - tableRSHasPK = false; - String currentTableName = (String)itr.next(); - HashSet pks = metadata.getAllPKsForTable(currentTableName); - HashSet pksInRS = new HashSet(); - for(int j=1; j<=resultSetSize; j++){ - if(currentTableName.equals(tablePropertyNames[j]) && - isPKColumn[j] ){ - pksInRS.add(columnPropertyNames[j]); - } - } - - //if pks null, means its classic case when all cols should be PKs - if(pks == null){ - tableRSHasPK = true; - } - //case when there were cols in cfg but could not find any PK in it and no ID column in cfg - else if(pks != null && pks.size()==1 && pks.contains("")){ - tableRSHasPK = false; - } - else if(pks != null && pksInRS.size() == pks.size()){ - Iterator itr1 = pks.iterator(); - int indx=0; - while(itr1.hasNext()){ - if(!pksInRS.contains((String)itr1.next())){ - indx++; - } - } - - if(indx == 0){ - if (this.logger.isDebugEnabled()) { - this.logger.debug("has PK TRUE - matched"); - } - tableRSHasPK = true; - }else{ - if (this.logger.isDebugEnabled()) { - this.logger.debug("has PK FALSE- mismatched"); - } - tableRSHasPK = false; - } - } - else{ - if (this.logger.isDebugEnabled()) { - this.logger.debug("has PK FALSE - rest all cases"); - } - } - - if (!tableRSHasPK) tablesWithNoPK.add(currentTableName); - - if (this.logger.isDebugEnabled()) { - this.logger.debug("table "+currentTableName+" hasValidPK "+tableRSHasPK); - } - } - } - - private void checkResultSetMissesPK(){ - //Default is TRUE(from TableData), so consider only FALSE case - Iterator itr = tablesWithNoPK.iterator(); - while(itr.hasNext()){ - String currentTableName = (String)itr.next(); - TableData table = getRawData(currentTableName); - table.setValidPrimaryKey(false); - allTableData.add(table); - } - } - - private void processRecursiveRow() throws SQLException { - int i = 1; - // create map to keep track of recursive indexes - // each recursive table contains a 0-based index to keep track of the sequence - Map recursiveIndexes = new HashMap(); - for (Iterator itTablePropertyNames = recursiveTablePropertyNames.iterator(); itTablePropertyNames.hasNext(); ) { - recursiveIndexes.put(itTablePropertyNames.next(), new Integer(-1)); - } - - // loop thru result set columns - // assuming that the columns of each recursive table are grouped together (metadata do not allow for further granularity) - while (i <= resultSetSize) { - TableData table; - String tablePropertyName = tablePropertyNames[i]; - if (recursiveTablePropertyNames.contains(tablePropertyName)) { - // increment current recursive index for table - int recursiveIndex = ((Integer) recursiveIndexes.get(tablePropertyName)).intValue() + 1; - recursiveIndexes.put(tablePropertyName, new Integer(recursiveIndex)); - // get table data - table = getRecursiveRawData(tablePropertyName, recursiveIndex); - } else { - table = getRawData(tablePropertyNames[i]); - } - - while ((i <= resultSetSize) && (isPKColumn[i])) { - Object data = getObject(currentResultSet, i); - if (this.logger.isDebugEnabled()) { - this.logger.debug("Adding column: " + columnPropertyNames[i] - + "\tValue: " + data + "\tTable: " - + tablePropertyNames[i]); - } - table.addData(columnPropertyNames[i], true, data); - i++; - } - - while ((i <= resultSetSize) && (!isPKColumn[i])) { - Object data = getObject(currentResultSet, i); - if (this.logger.isDebugEnabled()) { - this.logger.debug("Adding column: " + columnPropertyNames[i] - + "\tValue: " + data + "\tTable: " - + tablePropertyNames[i]); - } - table.addData(columnPropertyNames[i], false, data); - i++; - } - - // skip table if empty - if (table.isTableEmpty()) { - table.clear(); - } else { - this.allTableData.add(table); - } - - } - - checkResultSetMissesPK(); - } - - /** - * @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; - } - - return metadata.convert(i, data); - - } - - /** - * 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; - } - - private TableData getRecursiveRawData(String tableName, int recursiveIndex) { - String key = tableName + ":" + recursiveIndex; - TableData table = (TableData) tableMap.get(key); - - if (table == null) { - table = new TableData(tableName, recursiveIndex); - tableMap.put(key, table); - } - - return table; - } - - public List getAllTableData() { - return this.allTableData; - } - - public boolean isRecursive() { - return recursive; - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/RowObjects.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/RowObjects.java deleted file mode 100644 index b41b7379c8..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/RowObjects.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.log4j.Logger; -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 commonj.sdo.DataObject; -import commonj.sdo.Property; - -public class RowObjects { - private static final Logger logger = Logger.getLogger(RowObjects.class); - - private Map objectsByTableName; - - private List tableObjects; - - private Set newTableObjectNames; - - private Map tableTypeNames; - - private Map relationshipMap; - - private final GraphBuilderMetadata metadata; - - private final TableRegistry registry; - - private final MappingWrapper configWrapper; - - private final boolean hasRecursiveRelationships; - - public RowObjects(GraphBuilderMetadata metadata, TableRegistry registry) { - objectsByTableName = new HashMap(); - tableObjects = new ArrayList(); - newTableObjectNames = new HashSet(); - tableTypeNames = new HashMap(); - this.metadata = metadata; - this.registry = registry; - this.configWrapper = metadata.getConfigWrapper(); - this.hasRecursiveRelationships = configWrapper.hasRecursiveRelationships(); - if (!hasRecursiveRelationships) buildRelationshipMap(); - } - - private void buildRelationshipMap() { - relationshipMap = new HashMap(); - Iterator i = metadata.getRelationships().iterator(); - while (i.hasNext()) { - Relationship r = (Relationship) i.next(); - String parentTypeName = getTableTypeName(r.getPrimaryKeyTable()); - String childTypeName = getTableTypeName(r.getForeignKeyTable()); - // Add relationship under child type name - List relationships = (List) relationshipMap.get(childTypeName); - if (relationships == null) { - relationships = new ArrayList(); - relationshipMap.put(childTypeName, relationships); - } - relationships.add(r); - // Add relationship under parent type name - relationships = (List) relationshipMap.get(parentTypeName); - if (relationships == null) { - relationships = new ArrayList(); - relationshipMap.put(parentTypeName, relationships); - } - relationships.add(r); - } - } - - public void clear() { - objectsByTableName.clear(); - tableObjects.clear(); - newTableObjectNames.clear(); - } - - public void put(String key, DataObject value, boolean newlyCreated) { - objectsByTableName.put(key, value); - tableObjects.add(value); - if (newlyCreated) newTableObjectNames.add(key); - } - - public DataObject get(String tablePropertyName) { - return (DataObject) objectsByTableName.get(tablePropertyName); - } - - private String getTableTypeName(String tableName) { - String typeName = (String) tableTypeNames.get(tableName); - if (typeName == null) { - typeName = configWrapper.getTableTypeName(tableName); - tableTypeNames.put(tableName, typeName); - } - return typeName; - } - - public void processRelationships() { - if (hasRecursiveRelationships) { - processRecursiveRelationships(configWrapper); - return; - } - - // the relationship needs to be set only if the parent or the child is newly created - // otherwise the relationship has already been set - Set relationshipsToSet = new HashSet(); - Iterator itNewTableObjectNames = newTableObjectNames.iterator(); - while (itNewTableObjectNames.hasNext()) { - List relationships = (List) relationshipMap.get((String) itNewTableObjectNames.next()); - if (relationships != null) relationshipsToSet.addAll(relationships); - } - - Iterator i = relationshipsToSet.iterator(); - while (i.hasNext()) { - Relationship r = (Relationship) i.next(); - - String parentTypeName = getTableTypeName(r.getPrimaryKeyTable()); - String childTypeName = getTableTypeName(r.getForeignKeyTable()); - DataObject parent = get(parentTypeName); - DataObject child = get(childTypeName); - - if (this.logger.isDebugEnabled()) { - this.logger.debug("Parent table: " + parent); - this.logger.debug("Child table: " + child); - } - - setOrAdd(parent, child, r.getName()); - } - } - - 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); - - - setOrAdd(parentTable, table, r.getName()); - } - - } - } - - private void setOrAdd(DataObject parent, DataObject child, String propertyName) { - if (parent == null || child == null) return; - Property p = parent.getType().getProperty(propertyName); - if (p.isMany()) { - parent.getList(p).add(child); - } else { - parent.set(p, child); - } - } - - private DataObject findParentTable(DataObject childTable, Relationship r, MappingWrapper wrapper) { - - List 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)); - } - - if (this.logger.isDebugEnabled()) { - this.logger.debug("Trying to find parent of " + r.getForeignKeyTable() + " with FK " + fkValue); - } - - DataObject parentTable = registry.get(r.getPrimaryKeyTable(), fkValue); - - if (this.logger.isDebugEnabled()) { - this.logger.debug("Parent table from registry: " + parentTable); - } - - return parentTable; - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/SingleTableRegistry.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/SingleTableRegistry.java deleted file mode 100644 index 54474fa4b3..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/SingleTableRegistry.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 { - - - public SingleTableRegistry() { - // Empty Constructor - } - - public DataObject get(String tableName, List primaryKey) { - return null; - } - - - public void put(String tableName, List primaryKey, DataObject value) { - // do nothing - - } - - public boolean contains(String name, List list) { - return false; - } - - public void remove(String tableName, List primaryKey) { - - } -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java deleted file mode 100644 index a99f7ff12f..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.Map; - -import org.apache.log4j.Logger; - -public final class TableData { - private static final Logger logger = Logger.getLogger(TableData.class); - - private Map columnData; - - private List primaryKey;; - - private final String name; - - private int index = 0; - - private boolean hasValidPrimaryKey = true; - - private boolean hasNullPrimaryKey = false; - - public TableData(String tableName) { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Creating TableData for table " + tableName); - } - - this.name = tableName; - this.columnData = new HashMap(); - this.primaryKey = new ArrayList(); - } - - public TableData(String tableName, int index) { - this(tableName); - this.index = index; - } - - public void clear() { - columnData.clear(); - primaryKey.clear(); - hasValidPrimaryKey = true; - hasNullPrimaryKey = false; - } - - public void addData(String columnName, boolean isPrimaryKeyColumn, Object data) { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Adding column " + columnName + " with value " + data); - } - - if(data != null) - columnData.put(columnName, data); - if (isPrimaryKeyColumn) { - if (data == null) { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Column " + columnName + " is a primary key column and is null"); - } - hasNullPrimaryKey = true; - //hasValidPrimaryKey = false; - if uncommented and JIRA-1464, RecursiveTests.testReadEngineParts() will fail - } else { - primaryKey.add(data); - } - } - } - - public Object getColumnData(String columnName) { - return columnData.get(columnName); - } - - public String getTableName() { - return this.name; - } - - public int getIndex() { - return index; - } - - /** - * @return - */ - public List getPrimaryKeyValues() { - // the primary key is kept in the table registry - // so return a copy to prevent deletion - List primaryKeyCopy = new ArrayList(primaryKey.size()); - primaryKeyCopy.addAll(primaryKey); - return primaryKeyCopy; - } - - public boolean hasValidPrimaryKey() { - return hasValidPrimaryKey; - } - - public void setValidPrimaryKey(boolean hasValidPK){ - this.hasValidPrimaryKey = hasValidPK; - } - - public boolean isTableEmpty(){ - return columnData.keySet().isEmpty(); - } - - public boolean hasNullPrimaryKey(){ - return this.hasNullPrimaryKey; - } -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableRegistry.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableRegistry.java deleted file mode 100644 index 7a433fe240..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableRegistry.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 DataObject - */ - DataObject get(String tableName, List primaryKey); - - /** - * Add the table with the specified name and primary key - * - * @param tableName - * @param primaryKey - * @param value - */ - void put(String tableName, List primaryKey, DataObject value); - - boolean contains(String name, List list); - - void remove(String tableName, List primaryKey); -} \ No newline at end of file diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ResultSetTypeMap.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ResultSetTypeMap.java deleted file mode 100644 index 35701f88d0..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ResultSetTypeMap.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 final ResultSetTypeMap INSTANCE = new ResultSetTypeMap(); - - /** - * Constructor for ResultSetTypeMap. - */ - protected ResultSetTypeMap() { - // Empty Constructor - } - - /** - * - * @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"); - } - return helper.getType("commonj.sdo", "boolean"); - - - case Types.TINYINT: - case Types.SMALLINT: - case Types.INTEGER: - if (isNullable) { - return helper.getType("commonj.sdo", "IntObject"); - } - - return helper.getType("commonj.sdo", "Int"); - - - case Types.BIGINT: - if (isNullable) { - return helper.getType("commonj.sdo", "Long"); - } - return helper.getType("commonj.sdo", "long"); - - case Types.REAL: - if (isNullable) { - return helper.getType("commonj.sdo", "Float"); - } - return helper.getType("commonj.sdo", "float"); - - - case Types.FLOAT: - case Types.DOUBLE: - if (isNullable) { - return helper.getType("commonj.sdo", "Double"); - } - return helper.getType("commonj.sdo", "double"); - - - case Types.BINARY: - case Types.VARBINARY: - case Types.LONGVARBINARY: - return helper.getType("commonj.sdo", "Bytes"); - - case Types.DATE: - case Types.TIME: - case Types.TIMESTAMP: - return helper.getType("commonj.sdo", "Date"); - - case Types.CLOB: - return helper.getType("commonj.sdo", "Object"); - - case Types.BLOB: - return helper.getType("commonj.sdo", "Bytes"); - - case Types.ARRAY: - return helper.getType("commonj.sdo", "Object"); - - 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/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ApplyChangesCommandImpl.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ApplyChangesCommandImpl.java deleted file mode 100644 index b19aab85e8..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ApplyChangesCommandImpl.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.log4j.Logger; -import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; - -import commonj.sdo.DataObject; - -/** - * - */ -public class ApplyChangesCommandImpl extends BaseCommandImpl { - - private final Logger logger = Logger.getLogger(ApplyChangesCommandImpl.class); - - private ChangeSummarizer summarizer = new ChangeSummarizer(); - - public ApplyChangesCommandImpl(MappingWrapper config, Connection connection) { - this.configWrapper = config; - if (connection != null) { - setConnection(connection, config.getConfig()); - } - - } - - public void setConnection(ConnectionImpl connection) { - summarizer.setConnection(connection); - } - - public void execute(DataObject root) { - if (this.logger.isDebugEnabled()) { - this.logger.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/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/BaseCommandImpl.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/BaseCommandImpl.java deleted file mode 100644 index e6611e0a7f..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/BaseCommandImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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(); - - //when no config in method params, useGetGeneratedKeys will default to True - //as DBMS metadata method is not reliable in all cases - public void setConnection(Connection connection) { - setConnection(new ConnectionImpl(connection)); - } - - public void setConnection(Connection connection, Config config) { - boolean managed = true; - String generatedKeysSupported = null; - - if (config != null){ - if(config.getConnectionInfo() != null) { - managed = config.getConnectionInfo().isManagedtx(); - } - - generatedKeysSupported = config.getGeneratedKeysSupported(); - - setConnection(connection, managed, generatedKeysSupported); - } - else{ - setConnection(connection); - } - } - - public void setConnection(Connection connection, boolean manageTransaction, String generatedKeysSupported) { - ConnectionImpl c = new ConnectionImpl(connection); - c.setManageTransactions(manageTransaction); - c.setGeneratedKeysSupported(generatedKeysSupported); - setConnection(c); - } - - public abstract void setConnection(ConnectionImpl c); - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeFactory.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeFactory.java deleted file mode 100644 index f8c669ed43..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeFactory.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.log4j.Logger; -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 commonj.sdo.DataObject; - -public class ChangeFactory { - private final Logger logger = Logger.getLogger(ChangeFactory.class); - - private InsertCommandImpl createCommand; - - private UpdateCommandImpl updateCommand; - - private DeleteCommandImpl deleteCommand; - - private final MappingWrapper mapping; - - private final ConnectionImpl connection; - - public ChangeFactory(MappingWrapper mapping, ConnectionImpl connection) { - this.mapping = mapping; - this.connection = connection; - } - - public void setCreateCommand(InsertCommandImpl cmd) { - createCommand = cmd; - } - - public void setUpdateCommand(UpdateCommandImpl cmd) { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Setting Update Command to " + cmd); - } - - updateCommand = cmd; - } - - public void setDeleteCommand(DeleteCommandImpl cmd) { - deleteCommand = cmd; - } - - ChangeOperation createUpdateOperation(DataObject changedObject, String propagatedID) { - UpdateCommandImpl cmd = getUpdateCommand(changedObject); - if (cmd == null) { - return null; - } else { - return new UpdateOperation(cmd, 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); - } - - 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(mapping, table);//JIRA-952 - } else { - deleteCommand = new DeleteCommandImpl(delete); - } - deleteCommand.setConnection(connection); - deleteCommand.configWrapper = mapping; - } - return deleteCommand; - } - - private UpdateCommandImpl getUpdateCommand(DataObject changedObject) { - - Table table = mapping.getTableByTypeName(changedObject.getType().getName()); - if (table == null) { - if (changedObject.getType().getProperty("ID") != null) { - 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); - } - } - - if (updateCommand != null) { - updateCommand.setConnection(connection); - updateCommand.configWrapper = mapping; - } else { - if(this.logger.isDebugEnabled()) { - this.logger.debug("Update command is NULL"); - } - } - - if (this.logger.isDebugEnabled()) { - this.logger.debug("Returning updateCommand: " + updateCommand); - } - - return updateCommand; - } - - public MappingWrapper getConfig() { - return this.mapping; - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeOperation.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeOperation.java deleted file mode 100644 index b222c18177..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeOperation.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.log4j.Logger; - -import commonj.sdo.DataObject; - -/** - */ -public abstract class ChangeOperation { - protected DatabaseObject dObject; - - protected String propagatedID; - - private final Logger logger = Logger.getLogger(ChangeOperation.class); - - private final WriteCommandImpl writeCommand; - - private boolean isInsert; - - - 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() { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Executing change operation"); - } - - Iterator i = writeCommand.getParameters().iterator(); - while (i.hasNext()) { - ParameterExtendedImpl parm = (ParameterExtendedImpl) i.next(); - - if (this.logger.isDebugEnabled()) { - this.logger.debug("setting " + parm.getName() + " to " + dObject.get(parm.getName())); - } - - parm.setValue(dObject.get(parm.getName())); - } - - writeCommand.basicExecute(); - - if (isInsert && (propagatedID != null)) { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Propagating key " + propagatedID); - } - int id = writeCommand.getGeneratedKey(); - dObject.setPropagatedID(propagatedID, id); - } - } - - public String getTableName() { - return dObject.getTableName(); - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeSummarizer.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeSummarizer.java deleted file mode 100644 index 0f83dcd939..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeSummarizer.java +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.Map; - -import org.apache.log4j.Logger; -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.CollectionsUtil; -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 final Logger logger = Logger.getLogger(ChangeSummarizer.class); - - private Changes changes = new Changes(); - - private FactoryRegistry registry; - - private MappingWrapper mapping = new MappingWrapper(); - - private ConnectionImpl connection; - - private Map 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(); - - if (this.logger.isDebugEnabled()) { - this.logger.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)) { - if (this.logger.isDebugEnabled()) { - this.logger.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()); - if (this.logger.isDebugEnabled()) { - this.logger.debug("Change is a delete"); - } - changes.addDelete(factory.createDeleteOperation(changedObject)); - } else { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Change is a modify"); - } - List attrList = changeSummary.getOldValues(changedObject); - if (hasAttributeChange(attrList)) { - ChangeFactory factory = getRegistry().getFactory(changedObject.getType()); - if (this.logger.isDebugEnabled()) { - this.logger.debug("Attribute Change for " + changedObject.getType().getName()); - } - String propagatedID = (String) generatedKeys.get(changedObject.getType().getName()); - ChangeOperation op = factory.createUpdateOperation(changedObject, propagatedID); - if (op != null) { - changes.addUpdate(op); - } else { - if(this.logger.isDebugEnabled()) { - this.logger.debug("Update Operation is NULL"); - } - } - - } else { - List values = changeSummary.getOldValues(changedObject); - Iterator i = values.iterator(); - while (i.hasNext()) { - ChangeSummary.Setting setting = (ChangeSummary.Setting) i.next(); - if (!setting.getProperty().getType().isDataType()) { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Reference change for " + changedObject.getType().getName()); - } - Property ref = setting.getProperty(); - if (this.logger.isDebugEnabled()) { - this.logger.debug(ref.getName()); - } - if (hasState(ref, changedObject)) { - ChangeFactory factory = getRegistry().getFactory(changedObject.getType()); - ChangeOperation op = factory.createUpdateOperation(changedObject); - if (op != null) { - changes.addUpdate(op); - } else { - if(this.logger.isDebugEnabled()) { - this.logger.debug("Update Operation is NULL"); - } - } - - } - } - } - } - } - - } - - private boolean hasState(Property ref, DataObject changedObject) { - if (ref.getOpposite().isMany()) { - return true; - } - - 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()) { - if (rel.isKeyRestricted()) { - throw new RuntimeException("Can not modify a one to one relationship that is key restricted"); - } - // 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())) - && (CollectionsUtil.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()) { - //if SDO type, property is defined use it , else use dbms metadata - //with this static DOs will work correct for generated keys - if(t.getTypeName() != null && c.getPropertyName() != null) { - if (this.logger.isDebugEnabled()) { - this.logger.debug("adding generated key " + t.getTypeName() + "." + c.getPropertyName()); - } - - generatedKeys.put(t.getTypeName(), c.getPropertyName()); - } else { - if (this.logger.isDebugEnabled()) { - this.logger.debug("adding generated key " + t.getTableName() + "." + c.getColumnName()); - } - - generatedKeys.put(t.getTableName(), c.getColumnName()); - } - - } - } - } - } - - public ConnectionImpl getConnection() { - return this.connection; - } -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Changes.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Changes.java deleted file mode 100644 index 45f0a55719..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Changes.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.List; - -/** - * Manages 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 = deletes.getSortedList().iterator(); - while (i.hasNext()) { - ChangeOperation c = (ChangeOperation) i.next(); - c.execute(); - } - - 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(); - } - - } - - public void setInsertOrder(List insertOrder) { - inserts.setOrder(insertOrder); - } - - public void setDeleteOrder(List deleteOrder) { - deletes.setOrder(deleteOrder); - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CollisionParameter.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CollisionParameter.java deleted file mode 100644 index 48ff2ab57a..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CollisionParameter.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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; - -public class CollisionParameter extends ParameterExtendedImpl { - - private boolean isSet; - - public void setValue(Object value) { - if (!isSet) { - this.value = value; - isSet = true; - } - } -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandImpl.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandImpl.java deleted file mode 100644 index 6b1a2ad179..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandImpl.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.List; - -import org.apache.tuscany.das.rdb.Command; - -import commonj.sdo.DataObject; - -public abstract class CommandImpl extends BaseCommandImpl implements Command { - - protected Statement statement; - - protected ParametersExtendedImpl parameters = new ParametersExtendedImpl(); - - protected ResultSetShape resultSetShape; - - public CommandImpl(String sqlString) { - statement = new Statement(sqlString); - } - - public CommandImpl(org.apache.tuscany.das.rdb.config.Command command) { - this(command.getSQL()); - - if(command.getParameter() != null && command.getParameter().size() > 0) { - Iterator itr = command.getParameter().iterator(); - int index = 1; - while(itr.hasNext()){ - org.apache.tuscany.das.rdb.config.impl.ParameterImpl param = (org.apache.tuscany.das.rdb.config.impl.ParameterImpl)itr.next(); - if(param.getIndex() <= 0){ - param.setIndex(index); - index++; - } - ParameterExtendedImpl paramExt = new ParameterExtendedImpl(param); - addToParameters(paramExt); - } - } - } - - private void addToParameters(ParameterExtendedImpl paramExt) { - this.parameters.getParameter().add(paramExt); - if(paramExt.getDirection().equals(ParameterExtendedImpl.IN)){ - parameters.getInParameters().add(paramExt); - } - else{ - parameters.getOutParameters().add(paramExt); - } - } - - public abstract void execute(); - - public abstract DataObject executeQuery(); - - public void setParameter(int index, Object value) { - ParameterExtendedImpl param = parameters.getParameter(index); - if(param != null){ - param.setValue(value); - return; - } - - param = new ParameterExtendedImpl(); - param.setIndex(index); - param.setValue(value); - param.setDirection(ParameterExtendedImpl.IN); - parameters.getParameter().add(param); - parameters.getInParameters().add(param); - } - - public void addParameter(ParameterExtendedImpl param) { - //eliminate/replace duplicate params, index is filled, so can check it for duplicate - ParameterExtendedImpl paramExt = parameters.getParameter(param.getIndex()); - if(paramExt != null) - paramExt = new ParameterExtendedImpl(param); - - paramExt = parameters.getParameter(param.getIndex(), param.getDirection()); - if(paramExt != null){ - paramExt = new ParameterExtendedImpl(param); - return; - } - - addToParameters(param); - } - - public List getParameters() { - return parameters.getParameter(); - } - - public Object getParameter(int index) { - return parameters.getParameter(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(); - } - - //default direction IN assumed - public void setParameter(String name, Object value) { - ParameterExtendedImpl param = parameters.getParameter(name); - if(param != null){ - param.setValue(value); - return; - } - - param = new ParameterExtendedImpl(); - param.setIndex(parameters.getParameter().size()+1); - param.setName(name); - param.setValue(value); - param.setDirection(ParameterExtendedImpl.IN); - parameters.getParameter().add(param); - parameters.getInParameters().add(param); - } - - //default direction IN assumed - public Object getParameter(String name) { - Iterator itr = this.parameters.getInParameters().iterator(); - while(itr.hasNext()){ - ParameterExtendedImpl param = ((ParameterExtendedImpl)itr.next()); - - if(param.getName() != null && param.getName().equalsIgnoreCase(name)){ - return param.value; - } - } - return null; - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java deleted file mode 100644 index 5ee465027d..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.DatabaseMetaData; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import org.apache.log4j.Logger; - -public class ConnectionImpl { - - private final Logger logger = Logger.getLogger(ConnectionImpl.class); - - private Connection connection; - - private boolean managingTransaction = true; - - private String generatedKeysSupported = null; - - 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 String getGeneratedKeysSupported() { - return this.generatedKeysSupported; - } - - public void setGeneratedKeysSupported(String useGetGeneratedKeys){ - this.generatedKeysSupported = useGetGeneratedKeys; - } - - public boolean isGeneratedKeysSupported() { - try{ - if(this.generatedKeysSupported == null){ - DatabaseMetaData dbmsMetadata = this.connection.getMetaData(); - boolean supportsGetGeneratedKeys = dbmsMetadata.supportsGetGeneratedKeys(); - if(supportsGetGeneratedKeys){ - this.generatedKeysSupported = "true"; - } - //currently DERBY partially supports this feature and thus returns FALSE, - //this hardcoding is needed as the partial support is enough for DAS - //we can remove this later, when DERBY change the behaviour of it's "supportsGetGeneratedKeys" - else if(dbmsMetadata.getDatabaseProductName().indexOf("Derby") > 0){ - this.generatedKeysSupported = "true"; - } - else{ - this.generatedKeysSupported = "false"; - } - } - }catch(Exception e){//can be from supportsGetGeneratedKeys or due to absense of supportsGetGeneratedKeys - if (this.logger.isDebugEnabled()) { - this.logger.debug("exception setiing useGetGeneratedKeys false"); - } - this.generatedKeysSupported = "false"; - } - - if (this.logger.isDebugEnabled()) { - this.logger.debug("returning useGetGeneratedKeys():"+ this.generatedKeysSupported); - } - return Boolean.valueOf(this.generatedKeysSupported).booleanValue(); - } - - public void cleanUp() { - try { - if (managingTransaction) { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Committing Transaction"); - } - connection.commit(); - } - } catch (SQLException e) { - throw new RuntimeException(e); - } - } - - public void errorCleanUp() { - try { - if (managingTransaction) { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Rolling back Transaction"); - } - connection.rollback(); - } - } catch (SQLException e) { - throw new RuntimeException(e); - } - } - - public PreparedStatement prepareStatement(String queryString, String[] returnKeys) throws SQLException { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Preparing Statement: " + queryString); - this.logger.debug("Boolean value for use gen key: " + this.generatedKeysSupported); - } - - if (isGeneratedKeysSupported()) { - return connection.prepareStatement(queryString, Statement.RETURN_GENERATED_KEYS); - } else if (returnKeys.length > 0) { - return connection.prepareStatement(queryString, returnKeys); - } - - return connection.prepareStatement(queryString); - } - - public PreparedStatement preparePagedStatement(String queryString) throws SQLException { - if (this.logger.isDebugEnabled()) { - this.logger.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/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CreateOperation.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CreateOperation.java deleted file mode 100644 index 0163f96686..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CreateOperation.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASFactoryImpl.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASFactoryImpl.java deleted file mode 100644 index ba80b3bcb5..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASFactoryImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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(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/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASImpl.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASImpl.java deleted file mode 100644 index e456d65ef1..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DASImpl.java +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.DriverManager; -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.config.ConfigFactory; -import org.apache.tuscany.das.rdb.config.ConnectionInfo; -import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; -import org.apache.tuscany.das.rdb.exception.DataSourceInitializationException; -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 MappingWrapper configWrapper; - - private Connection connection; - - private Map commands = new HashMap(); - - public DASImpl(InputStream stream) { - this(ConfigUtil.loadConfig(stream)); - - } - - public DASImpl(Config inConfig) { - Config cfg = inConfig; - if (cfg == null) { - cfg = ConfigFactory.INSTANCE.createConfig(); - } - this.configWrapper = new MappingWrapper(cfg); - - Iterator i = configWrapper.getConfig().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, configWrapper, commandConfig.getResultDescriptor())); - } else if (kind.equalsIgnoreCase("update")) { - commands.put(commandConfig.getName(), new UpdateCommandImpl(commandConfig)); - } else if (kind.equalsIgnoreCase("insert")) { - commands.put(commandConfig.getName(), new InsertCommandImpl(commandConfig, new String[0])); - } else if (kind.equalsIgnoreCase("delete")) { - commands.put(commandConfig.getName(), new DeleteCommandImpl(commandConfig)); - } else if (kind.equalsIgnoreCase("procedure")) { - commands.put(commandConfig.getName(), new SPCommandImpl(commandConfig.getSQL(), configWrapper, commandConfig.getParameter())); - } else { - throw new RuntimeException("Invalid kind of command: " + kind); - } - - } - - } - - 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) { - this(ConfigFactory.INSTANCE.createConfig()); - setConnection(inConnection); - } - - /* - * (non-Javadoc) - * - * @see org.apache.tuscany.das.rdb.CommandGroup#getApplyChangesCommand() - */ - public ApplyChangesCommandImpl getApplyChangesCommand() { - ApplyChangesCommandImpl cmd = new ApplyChangesCommandImpl(configWrapper, getConnection()); - 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(), configWrapper.getConfig()); - return cmd; - } - - public void setConnection(Connection connection) { - this.connection = connection; - } - - public Connection getConnection() { - if (connection == null) { - initializeConnection(); - } - return connection; - } - - private void initializeConnection() { - Config config = configWrapper.getConfig(); - if (config == null || config.getConnectionInfo() == null || - (config.getConnectionInfo().getDataSource() == null && - (config.getConnectionInfo().getConnectionProperties() == null || config.getConnectionInfo().getConnectionProperties().getDatabaseURL() == null - || config.getConnectionInfo().getConnectionProperties().getDriverClass() == null)) ) { - throw new RuntimeException("No connection has been provided and no data source has been specified"); - } - - if(config.getConnectionInfo().getDataSource() != null && - (config.getConnectionInfo().getConnectionProperties() != null && config.getConnectionInfo().getConnectionProperties().getDatabaseURL() != null) ){ - throw new RuntimeException("Use either dataSource or databaseURL. Can't use both !"); - } - - ConnectionInfo connectionInfo = configWrapper.getConfig().getConnectionInfo(); - if(config.getConnectionInfo().getDataSource() != null){ - initializeDatasourceConnection(connectionInfo); - }else{ - initializeDriverManagerConnection(connectionInfo); - } - - } - - /** - * Initializes a DB connection on a managed environmet (e.g inside Tomcat) - */ - private void initializeDatasourceConnection(ConnectionInfo connectionInfo){ - Connection connection = null; - - InitialContext ctx; - try { - ctx = new InitialContext(); - } catch (NamingException e) { - throw new RuntimeException(e); - } - try { - DataSource ds = (DataSource) ctx.lookup(connectionInfo.getDataSource()); - try { - try { - if(connectionInfo.getConnectionProperties() != null && - connectionInfo.getConnectionProperties().getUserName() != null && - connectionInfo.getConnectionProperties().getPassword() != null ) { - connection = ds.getConnection(connectionInfo.getConnectionProperties().getUserName(), connectionInfo.getConnectionProperties().getPassword()); - } else { - connection = ds.getConnection(); - } - }catch(Exception e) { - connection = ds.getConnection(); - } - - if (connection == null) { - throw new RuntimeException("Could not obtain a Connection from DataSource"); - } - connection.setAutoCommit(false); - setConnection(connection); - } catch (SQLException e) { - throw new RuntimeException(e); - } - } catch (NamingException e) { - throw new RuntimeException(e); - } - } - - /** - * Initialize a DB connection on a J2SE environment - * For more info, see http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/drivermanager.html - */ - private void initializeDriverManagerConnection(ConnectionInfo connectionInfo) { - - Connection connection = null; - - if (connectionInfo.getConnectionProperties() == null) { - throw new DataSourceInitializationException("No existing context and no connection properties"); - } - - if (connectionInfo.getConnectionProperties().getDriverClass() == null) { - throw new DataSourceInitializationException("No jdbc driver class specified!"); - } - - try { - //initialize driver and register it with DriverManager - Class.forName(connectionInfo.getConnectionProperties().getDriverClass()); - - //prepare to initialize connection - String databaseUrl = connectionInfo.getConnectionProperties().getDatabaseURL(); - String userName = connectionInfo.getConnectionProperties().getUserName(); - String userPassword = connectionInfo.getConnectionProperties().getPassword(); - int loginTimeout = connectionInfo.getConnectionProperties().getLoginTimeout(); - - DriverManager.setLoginTimeout(loginTimeout); - if( (userName == null || userName.length() ==0) && (userPassword == null || userPassword.length()==0) ){ - //no username or password suplied - connection = DriverManager.getConnection(databaseUrl); - }else{ - connection = DriverManager.getConnection(databaseUrl, userName, userPassword); - } - - if(connection == null){ - throw new DataSourceInitializationException("Error initializing connection : null"); - } - - connection.setAutoCommit(false); - setConnection(connection); - - - }catch(ClassNotFoundException cnf){ - throw new DataSourceInitializationException("JDBC Driver '" + connectionInfo.getConnectionProperties().getDriverClass() + "' not found", cnf); - }catch(SQLException sqle){ - throw new DataSourceInitializationException(sqle.getMessage(), sqle); - } - - } - - 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 (configWrapper.getConfig().getConnectionInfo().getDataSource() == null) { - return false; - } - - return true; - - } - - public Command createCommand(String sql) { - return baseCreateCommand(sql, this.configWrapper); - } - - public Command createCommand(String sql, Config config) { - return baseCreateCommand(sql, new MappingWrapper(config)); - } - - private Command baseCreateCommand(String inSql, MappingWrapper config) { - CommandImpl returnCmd = null; - String sql = inSql.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, new String[0]); - 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.getConfig()); - return returnCmd; - } - - public void applyChanges(DataObject root) { - getApplyChangesCommand().execute(root); - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DatabaseObject.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DatabaseObject.java deleted file mode 100644 index 18a6d8d193..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DatabaseObject.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.Map; - -import org.apache.log4j.Logger; -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.config.wrapper.TableWrapper; - -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 Logger logger = Logger.getLogger(DatabaseObject.class); - - private final MappingWrapper mappingWrapper; - - private final DataObject dataObject; - - private Property parentReference; - - private Map 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(); - if (this.logger.isDebugEnabled()) { - this.logger.debug("Initializing relationship: " + r.getName()); - this.logger.debug("r.getForeignKeyTable():"+r.getForeignKeyTable()); - this.logger.debug("getTypeName():"+getTypeName()); - } - - Table fkTable = mappingWrapper.getTableByTypeName(getTypeName()); - String fkTableName = null; - if(fkTable != null) { - if(mappingWrapper.getConfig().isDatabaseSchemaNameSupported()) { - fkTableName = fkTable.getSchemaName()+"."+fkTable.getTableName(); - } else { - fkTableName = fkTable.getTableName(); - } - } else {//this can happen when no
in Config and Query based Dynamic Types are used during query - fkTableName = getTypeName(); - } - - if (r.getForeignKeyTable().equals(fkTableName)) { - List pairs = r.getKeyPair(); - Iterator iter = pairs.iterator(); - while (iter.hasNext()) { - KeyPair pair = (KeyPair) iter.next(); - keyMappings.put(pair.getForeignKeyColumn(), r); - if (this.logger.isDebugEnabled()) { - this.logger.debug("Putting key pair: " + pair.getPrimaryKeyColumn()+","+pair.getForeignKeyColumn()); - } - } - } - } - } - } - - 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); - } - - //JIRA-952 - Table tbl = this.mappingWrapper.getTable(r.getPrimaryKeyTable()); - Property parentRef = null; - if(tbl == null){ - //this is case when config file is not present and - //ConfigHelper helper = new ConfigHelper(); is used - parentRef = getParentReference(r.getPrimaryKeyTable()); - } - else{ - //other cases, its better to use typeName as r.getPrimaryKeyTable() - //gives tableName and tableName and typeName can be different - //and SDO looks for typeName and not tableName. - parentRef = getParentReference((new TableWrapper(tbl)).getTypeName()); - } - - DataObject parent = dataObject.getDataObject(parentRef); - - if (parent == null) { - return null; - } - String parentKey = getParentKey(r, parameter);//parentKey is db column name - - String parentTableName = null; - //as parentKey is qualified column name and not SDO property name, do conversion, when possible, thru
- tbl = mappingWrapper.getTableByTypeName(parent.getType().getName()); - if(tbl != null) { - if(mappingWrapper.getConfig().isDatabaseSchemaNameSupported()) { - parentTableName = tbl.getSchemaName()+"."+tbl.getTableName(); - } else { - parentTableName = tbl.getTableName(); - } - String parentKeyProp = mappingWrapper.getColumnPropertyName(parentTableName, parentKey); - - return parent.get(parentKeyProp); - } else { - return parent.get(parentKey); - } - } - - /*This returns table column name*/ - 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; - } - - //JIRA-952 - public String getTableName() { - if (mappingWrapper.getConfig() != null) { - - if(mappingWrapper.getConfig().isDatabaseSchemaNameSupported()){ - if (this.logger.isDebugEnabled()) { - this.logger.debug("DatabaseObject.getTableName:(schemaName.tableName) " + - mappingWrapper.getTableByTypeName(getTypeName()).getSchemaName()+"."+ - mappingWrapper.getTableByTypeName(getTypeName()).getTableName()); - } - - return (mappingWrapper.getTableByTypeName(getTypeName()).getSchemaName()+"."+ - mappingWrapper.getTableByTypeName(getTypeName()).getTableName()); - } - else{ - if (this.logger.isDebugEnabled()) { - this.logger.debug("DatabaseObject.getTableName: " + mappingWrapper.getTableByTypeName(getTypeName()).getTableName()); - } - - return mappingWrapper.getTableByTypeName(getTypeName()).getTableName(); - } - } - return null; - } - - public String getTypeName() { - if (this.logger.isDebugEnabled()) { - this.logger.debug("DatabaseObject.getTypeName: " + dataObject.getType().getName()); - } - 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/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteCommandImpl.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteCommandImpl.java deleted file mode 100644 index ca85569272..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteCommandImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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(org.apache.tuscany.das.rdb.config.Command command) { - super(command); - } - - public DeleteCommandImpl(String sqlString) { - super(sqlString); - } - - public DeleteCommandImpl(Delete delete) { - super(delete.getSql()); - this.addParameters(delete.getParameters()); - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteList.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteList.java deleted file mode 100644 index feb7e31411..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteList.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.List; -import java.util.Map; - -/** - * DeleteList will sort delete operations so that child objects are deleted before their parents - * - * - */ -public class DeleteList { - - private Map opsByTableName = new HashMap(); - - private List order; - - private List deleteOperations = new ArrayList(); - - public DeleteList() { - super(); - } - - public void add(ChangeOperation op) { - if ((order.size() == 0) || (op.getTableName() == null)) { - deleteOperations.add(op); - } else { - String name = op.getTableName(); - List ops = (List) opsByTableName.get(name); - if (ops == null) { - ops = new ArrayList(); - } - ops.add(op); - opsByTableName.put(name, ops); - } - } - - public Collection getSortedList() { - if ((order.size() > 0) && (opsByTableName.keySet().size() > 0)) { - Iterator i = this.order.iterator(); - while (i.hasNext()) { - String name = (String) i.next(); - if (opsByTableName.get(name) != null) { - deleteOperations.addAll((Collection) opsByTableName.get(name)); - } - } - } - - return deleteOperations; - } - - public void setOrder(List deleteOrder) { - this.order = deleteOrder; - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteOperation.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteOperation.java deleted file mode 100644 index 52935599c1..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteOperation.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/FactoryRegistry.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/FactoryRegistry.java deleted file mode 100644 index bb148635c8..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/FactoryRegistry.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.Map; - -import org.apache.log4j.Logger; -import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; - -import commonj.sdo.Type; - -public class FactoryRegistry { - - private final Logger logger = Logger.getLogger(FactoryRegistry.class); - - private Map registry = new HashMap(); - - 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) { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Creating new ChangeFactory for type " + type.getName()); - } - - factory = new ChangeFactory(mapping, connection); - registry.put(type, factory); - } - return factory; - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertCommandImpl.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertCommandImpl.java deleted file mode 100644 index 61967475bd..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertCommandImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 String[] keys; - - public InsertCommandImpl(org.apache.tuscany.das.rdb.config.Command command, String[] generatedKeys) { - super(command); - keys = generatedKeys; - } - - public InsertCommandImpl(String sqlString, String[] generatedKeys) { - super(sqlString); - keys = generatedKeys; - } - - public InsertCommandImpl(Create create) { - super(create.getSql()); - this.addParameters(create.getParameters()); - this.keys = new String[0]; - } - - public void execute() { - - boolean success = false; - try { - statement.executeUpdate(parameters, keys); - success = true; - } catch (SQLException e) { - throw new RuntimeException(e); - } finally { - if (success) { - statement.getConnection().cleanUp(); - } else { - statement.getConnection().errorCleanUp(); - } - } - - } - - public int getGeneratedKey() { - try { - Integer key = statement.getGeneratedKey(); - if(key != null) - return key.intValue(); - else - throw new RuntimeException("Could not obtain generated key!"); - } catch (SQLException ex) { - throw new RuntimeException(ex); - } - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertList.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertList.java deleted file mode 100644 index e61ccfe21e..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertList.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; - -/** - * InsertList will sort ChangeOperation objects so that parents are inserted before children - * - * - */ -public class InsertList { - private final Logger logger = Logger.getLogger(InsertList.class); - - private Map opsByTableName = new HashMap(); - - private List insertOperations = new ArrayList(); - - private List order; - - public void add(ChangeOperation op) { - if (this.logger.isDebugEnabled()) { - this.logger.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(); - List ops = (List) opsByTableName.get(name); - if (ops == null) { - ops = new ArrayList(); - } - - ops.add(op); - opsByTableName.put(name, ops); - } - } - - public Collection getSortedList() { - if (this.logger.isDebugEnabled()) { - this.logger.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(); - if (this.logger.isDebugEnabled()) { - this.logger.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)); - } - } - } - if (this.logger.isDebugEnabled()) { - this.logger.debug("Returning " + insertOperations.size() + " insert operations"); - } - - return insertOperations; - } - - public void setOrder(List insertOrder) { - this.order = insertOrder; - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ManagedParameterImpl.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ManagedParameterImpl.java deleted file mode 100644 index f2f3ccdd79..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ManagedParameterImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.math.BigDecimal; - -public class ManagedParameterImpl extends ParameterExtendedImpl { - - 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 if (oldValue instanceof BigDecimal) { - return ((BigDecimal) oldValue).add(new BigDecimal(1)); - } else { - throw new RuntimeException("Unsupported type for managed column: " + oldValue.getClass().getName()); - } - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/OptimisticWriteCommandImpl.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/OptimisticWriteCommandImpl.java deleted file mode 100644 index 0a5f6951e9..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/OptimisticWriteCommandImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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; -import org.apache.tuscany.das.rdb.exception.OptimisticConcurrencyException; - -public class OptimisticWriteCommandImpl extends UpdateCommandImpl { - - public OptimisticWriteCommandImpl(String sqlString) { - super(sqlString); - } - - public OptimisticWriteCommandImpl(Update update) { - super(update); - addParameters(update.getParameters()); - } - - public void basicExecute() { - try { - int rowsAffected = statement.executeUpdate(parameters); - if (rowsAffected == 0) { - throw new OptimisticConcurrencyException("An update collision occurred"); - } - } catch (SQLException e) { - throw new RuntimeException(e); - } - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/PagerImpl.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/PagerImpl.java deleted file mode 100644 index 27b653763b..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/PagerImpl.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterExtendedImpl.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterExtendedImpl.java deleted file mode 100644 index db98b130ba..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterExtendedImpl.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.tuscany.das.rdb.config.impl.ParameterImpl; - -import commonj.sdo.Type; - -public class ParameterExtendedImpl extends ParameterImpl{ - /** - * Value for "Direction" that indicates that a parameter is soley for input. - */ - static final String IN = "IN"; - - /** - * Value for "Direction" that indicates that a parameter is soley for output. - * Out parameters only apply to Stored Procedures - */ - static final String OUT = "OUT"; - - /** - * Value for "Direction" that indicates that a parameter is for both input and output. - * In-out parameters only apply to stored procedures - */ - static final String IN_OUT = "IN_OUT"; - - private Type type; - - protected Object value; - - private Converter converter; - - public ParameterExtendedImpl() { - super(); - this.direction = IN; - } - - public ParameterExtendedImpl(org.apache.tuscany.das.rdb.config.impl.ParameterImpl parameterImpl) { - this.columnType = parameterImpl.getColumnType(); - this.direction = parameterImpl.getDirection(); - this.index = parameterImpl.getIndex(); - this.name = parameterImpl.getName(); - } - - public void setType(Type type) { - this.type = type; - } - - public Type getType() { - return this.type; - } - - public void setColumnType(String newColumnType) { - super.setColumnType(newColumnType); - if(newColumnType != null){ - String arg0 = newColumnType.substring(0, newColumnType.lastIndexOf(".")); - String arg1 = newColumnType.substring(newColumnType.lastIndexOf(".")+1); - this.type = SDODataTypes.TYPE_HELPER.getType(arg0, arg1); - } - } - - public void setValue(Object value) { - this.value = value; - } - - public Object getValue() { - if (getConverter() != null) { - return getConverter().getColumnValue(this.value); - } - - return this.value; - } - - public void setConverter(Converter converter) { - this.converter = converter; - } - - public Converter getConverter() { - return this.converter; - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterImpl.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterImpl.java deleted file mode 100644 index 3e23faf069..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterImpl.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - */ - static final int IN = 1; - - /** - * Value for "Direction" that indicates that a parameter is soley for output. - * Out parameters only apply to Stored Procedures - */ - static final 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 - */ - static final int IN_OUT = 3; - - protected Object value; - - private int index; - - private Type type; - - private String name; - - private int direction = IN; - - private Converter converter; - - - public ParameterImpl() { - super(); - } - - 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); - } - - return this.value; - } - - public int getDirection() { - return this.direction; - } - - public void setConverter(Converter converter) { - this.converter = converter; - } - - public Converter getConverter() { - return this.converter; - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Parameters.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Parameters.java deleted file mode 100644 index bebfba9ce9..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Parameters.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.log4j.Logger; - -import commonj.sdo.Type; - -public class Parameters { - private final Logger logger = Logger.getLogger(Parameters.class); - - private List parameters = new ArrayList(); - - private List inParams = new ArrayList(); - - private List outParams = new ArrayList(); - - 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; - } - } - if (this.logger.isDebugEnabled()) { - this.logger.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/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParametersExtendedImpl.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParametersExtendedImpl.java deleted file mode 100644 index 190695ae14..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParametersExtendedImpl.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.StringTokenizer; - -import org.apache.log4j.Logger; -import org.apache.tuscany.das.rdb.config.Parameters; -import org.apache.tuscany.das.rdb.config.impl.ParameterImpl; -import org.apache.tuscany.das.rdb.config.impl.ParametersImpl; - -import commonj.sdo.Type; - -public class ParametersExtendedImpl extends ParametersImpl{ - private final Logger logger = Logger.getLogger(ParametersExtendedImpl.class); - private List inParams = new ArrayList(); - - private List outParams = new ArrayList(); - - public ParametersExtendedImpl(){ - - } - - public ParametersExtendedImpl(List paramsList) { - if(this.parameter == null){ - this.parameter = new ArrayList(); - } - if(paramsList != null){ - for(int i=0; i JDK5 - for(Iterator it = this.resultDescriptors.iterator() ; it.hasNext();){ - - if(!(it.next() instanceof ResultDescriptor)){ - throw new RuntimeException("Elements in List not of type ResultDescriptor!"); - } - - } - refreshResultSetShape(); - } - } - - public List getResultDescriptors(){ - return this.resultDescriptors; - } - - public void addResultDescriptor(ResultDescriptor resultDescriptor){ - //if >= 0 columnIndex, add/replace for given index - //if < 0 columnIndex, add at end of current list - if(resultDescriptor == null) { - return; - } - - if(this.resultDescriptors == null){ - this.resultDescriptors = new ArrayList(); - } - - if(resultDescriptor.getColumnIndex() <0){ - this.resultDescriptors.add(deepCopyResultDescriptor(resultDescriptor));//dont care about columnIndex,add at end, old way - } - else{ - ResultDescriptor existing = getResultDescriptor(resultDescriptor.getColumnIndex()); - if(existing != null){ - removeResultDescriptor(resultDescriptor.getColumnIndex()); - } - this.resultDescriptors.add(deepCopyResultDescriptor(resultDescriptor));//add at end, sorting will happen below - } - - refreshResultSetShape(); - } - - - public ResultDescriptor removeResultDescriptor(int columnIndex){ - //if < 0 index return null - //if >=0 index and available at given index, remove and return same - //if >=0 index and not available at given index, return null - ResultDescriptor existing = null; - if(columnIndex >=0 && ((existing = getResultDescriptor(columnIndex)) != null) ){ - this.resultDescriptors.remove(existing); - refreshResultSetShape(); - return existing; - } - return null; - } - - public ResultDescriptor removeResultDescriptor(ResultDescriptor resultDescriptor){ - //remove and return only if matched for index, name, type, table name, schema name - //else return null - if(resultDescriptor != null){ - ResultDescriptor existing = getResultDescriptor(resultDescriptor.getColumnIndex()); - if(existing != null && - existing.getColumnName().equals(resultDescriptor.getColumnName()) && - existing.getColumnType().equals(resultDescriptor.getColumnType()) && - existing.getTableName().equals(resultDescriptor.getTableName()) ) { - if(this.configWrapper.getConfig().isDatabaseSchemaNameSupported()){//multi schema support - if(resultDescriptor.getSchemaName() != null && existing.getSchemaName() != null - && resultDescriptor.getSchemaName().equals(existing.getSchemaName())){ - this.resultDescriptors.remove(existing); - refreshResultSetShape(); - return existing; - } - return null; - } - else{ - this.resultDescriptors.remove(existing); - refreshResultSetShape(); - return existing; - } - } - } - return null; - } - - public ResultDescriptor getResultDescriptor(int columnIndex){ - //if <0 index return null - //if >=0 index and available at given index, return same - //if >=0 index and not available at given index, return null - if(columnIndex >=0 && this.resultDescriptors != null){ - - for(Iterator it = this.resultDescriptors.iterator() ; it.hasNext();){ - ResultDescriptor rs = (ResultDescriptor) it.next(); - - if( rs.getColumnIndex() == columnIndex){ - return rs; - } - - } - } - - return null; - } - - //Utility method - public void printResultDescriptors(OutputStream ostrm) throws IOException{ - if(this.resultDescriptors != null && this.resultDescriptors.size() != 0){ - - for(Iterator it = this.resultDescriptors.iterator() ; it.hasNext();){ - ostrm.write( it.next().toString().getBytes() ); - ostrm.write('\n'); - - } - ostrm.flush(); - - } - } - - 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 { - List results = statement.executeQuery(parameters); - success = true; - return buildGraph(results); - } catch (SQLException e) { - throw new RuntimeException(e); - } finally { - if (success) { - statement.getConnection().cleanUp(); - } else { - statement.getConnection().errorCleanUp(); - } - } - } - - protected DataObject buildGraph(List results) throws SQLException { - - // 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.getRootType()); - - SDOUtil.registerDataGraphTypes(g, gbmd.getDefinedTypes()); - - 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; - } - - - protected void enablePaging() { - statement.enablePaging(); - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ResultSetShape.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ResultSetShape.java deleted file mode 100644 index a9744d42b9..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ResultSetShape.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.Config; -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. - *

- * 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; - - private final String[] schema;//JIRA-952 - //JIRA-952 - public ResultSetShape(ResultSetMetaData metadata, Config model) throws SQLException { - columns = new String[metadata.getColumnCount()]; - tables = new String[metadata.getColumnCount()]; - types = new Type[metadata.getColumnCount()]; - schema = new String[metadata.getColumnCount()]; - - ResultSetTypeMap typeMap = ResultSetTypeMap.INSTANCE; - for (int i = 1; i <= metadata.getColumnCount(); i++) { - if(model.isDatabaseSchemaNameSupported()){ - if(metadata.getSchemaName(i) != null && !metadata.getSchemaName(i).equals("")){ - //tables[i - 1] = metadata.getSchemaName(i)+"."+metadata.getTableName(i); - tables[i - 1] = metadata.getTableName(i); - schema[i - 1] = metadata.getSchemaName(i); - } - else{ - tables[i - 1] = metadata.getTableName(i); - schema[i - 1] = ""; - } - } - else{ - tables[i - 1] = metadata.getTableName(i); - schema[i - 1] = ""; - } - columns[i - 1] = metadata.getColumnName(i); - types[i - 1] = typeMap.getType(metadata.getColumnType(i), true); - } - } - - //JIRA-952 - protected ResultSetShape(List resultDescriptor, Config model) { - TypeHelper helper = TypeHelper.INSTANCE; - int size = resultDescriptor.size(); - columns = new String[size]; - tables = new String[size]; - types = new Type[size]; - schema = new String[size]; - - for (int i = 0; i < size; i++) { - ResultDescriptor desc = (ResultDescriptor) resultDescriptor.get(i); - if(model.isDatabaseSchemaNameSupported()){ - if(desc.getSchemaName() != null && !desc.getSchemaName().equals("")){ - tables[i] = desc.getTableName(); - schema[i] = desc.getSchemaName(); - }else{ - tables[i] = desc.getTableName(); - schema[i] = ""; - } - - }else{ - tables[i] = desc.getTableName(); - schema[i] = ""; - } - 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]; - } - - //JIRA-952 - public String getSchemaName(int i) { - return schema[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/schema/type: "); - for (int i = 0; i < columns.length; i++) { - result.append(columns[i]); - result.append('\t'); - result.append(tables[i]); - result.append('\t'); - result.append(schema[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/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypeHelper.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypeHelper.java deleted file mode 100644 index 5f24099743..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypeHelper.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 final class SDODataTypeHelper { - - private SDODataTypeHelper() { - - } - - public static String columnTypeForSDOType(Type sdoType){ - if(sdoType == null) { - throw new RuntimeException("Null SDO Data Type!"); - } - - if(!sdoType.isDataType()) { - throw new RuntimeException("Invalid SDO Data Type! "+sdoType.getName()); - } - - if (sdoType == SDODataTypes.BOOLEAN) { - return SDODataTypes.BOOLEAN_STR; - } else if (sdoType == SDODataTypes.BOOLEANOBJECT) { - return SDODataTypes.BOOLEANOBJECT_STR; - } else if (sdoType == SDODataTypes.BYTE) { - return SDODataTypes.BYTE_STR; - } else if (sdoType == SDODataTypes.BYTEOBJECT) { - return SDODataTypes.BYTEOBJECT_STR; - } else if (sdoType == SDODataTypes.BYTES) { - return SDODataTypes.BYTES_STR; - } else if (sdoType == SDODataTypes.CHARACTER) { - return SDODataTypes.CHARACTER_STR; - } else if (sdoType == SDODataTypes.CHARACTEROBJECT) { - return SDODataTypes.CHARACTEROBJECT_STR; - } else if (sdoType == SDODataTypes.DATE) { - return SDODataTypes.DATE_STR; - } else if (sdoType == SDODataTypes.DATETIME) { - return SDODataTypes.DATETIME_STR; - } else if (sdoType == SDODataTypes.DAY) { - return SDODataTypes.DAY_STR; - } else if (sdoType == SDODataTypes.DECIMAL) { - return SDODataTypes.DECIMAL_STR; - } else if (sdoType == SDODataTypes.STRING) { - return SDODataTypes.STRING_STR; - } else if (sdoType == SDODataTypes.DOUBLE) { - return SDODataTypes.DOUBLE_STR; - } else if (sdoType == SDODataTypes.DOUBLEOBJECT) { - return SDODataTypes.DOUBLEOBJECT_STR; - } else if (sdoType == SDODataTypes.DURATION) { - return SDODataTypes.DURATION_STR; - } else if (sdoType == SDODataTypes.FLOAT) { - return SDODataTypes.FLOAT_STR; - } else if (sdoType == SDODataTypes.FLOATOBJECT) { - return SDODataTypes.FLOATOBJECT_STR; - } else if (sdoType == SDODataTypes.INT) { - return SDODataTypes.INT_STR; - } else if (sdoType == SDODataTypes.INTEGER) { - return SDODataTypes.INTEGER_STR; - } else if (sdoType == SDODataTypes.INTOBJECT) { - return SDODataTypes.INTOBJECT_STR; - } else if (sdoType == SDODataTypes.LONG) { - return SDODataTypes.LONG_STR; - } else if (sdoType == SDODataTypes.LONGOBJECT) { - return SDODataTypes.LONGOBJECT_STR; - } else if (sdoType == SDODataTypes.MONTH) { - return SDODataTypes.MONTH_STR; - } else if (sdoType == SDODataTypes.MONTHDAY) { - return SDODataTypes.MONTHDAY_STR; - } else if (sdoType == SDODataTypes.OBJECT) { - return SDODataTypes.OBJECT_STR; - } else if (sdoType == SDODataTypes.SHORT) { - return SDODataTypes.SHORT_STR; - } else if (sdoType == SDODataTypes.SHORTOBJECT) { - return SDODataTypes.SHORTOBJECT_STR; - } else if (sdoType == SDODataTypes.STRING) { - return SDODataTypes.STRING_STR; - } else if (sdoType == SDODataTypes.STRINGS) { - return SDODataTypes.STRINGS_STR; - } else if (sdoType == SDODataTypes.TIME) { - return SDODataTypes.TIME_STR; - } else if (sdoType == SDODataTypes.URI) { - return SDODataTypes.URI_STR; - } else if (sdoType == SDODataTypes.YEAR) { - return SDODataTypes.YEAR_STR; - } else if (sdoType == SDODataTypes.YEARMONTH) { - return SDODataTypes.YEARMONTH_STR; - } else if (sdoType == SDODataTypes.YEARMONTHDAY) { - return SDODataTypes.YEARMONTHDAY_STR; - } else { - throw new RuntimeException("Invalid SDO Data Type " + sdoType.getName()); - } - } - - public static 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.VARCHAR; - } 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.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.INTOBJECT) { - 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("Invalid SDO Data Type " + sdoType.getName()); - } - - } -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypes.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypes.java deleted file mode 100644 index db520b249f..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypes.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - * and due to final consts reduce number of string creation - */ -public class SDODataTypes { - - public static final TypeHelper TYPE_HELPER = TypeHelper.INSTANCE; - - public static final Type BOOLEAN = TYPE_HELPER.getType("commonj.sdo", "Boolean"); - public static final String BOOLEAN_STR = "commonj.sdo.Boolean"; - - public static final Type BOOLEANOBJECT = TYPE_HELPER.getType("commonj.sdo", "BooleanObject"); - public static final String BOOLEANOBJECT_STR = "commonj.sdo.BooleanObject"; - - public static final Type BYTE = TYPE_HELPER.getType("commonj.sdo", "Byte"); - public static final String BYTE_STR = "commonj.sdo.Byte"; - - public static final Type BYTEOBJECT = TYPE_HELPER.getType("commonj.sdo", "ByteObject"); - public static final String BYTEOBJECT_STR = "commonj.sdo.ByteObject"; - - public static final Type BYTES = TYPE_HELPER.getType("commonj.sdo", "Bytes"); - public static final String BYTES_STR = "commonj.sdo.Bytes"; - - public static final Type CHARACTER = TYPE_HELPER.getType("commonj.sdo", "Character"); - public static final String CHARACTER_STR = "commonj.sdo.Character"; - - public static final Type CHARACTEROBJECT = TYPE_HELPER.getType("commonj.sdo", "CharacterObject"); - public static final String CHARACTEROBJECT_STR = "commonj.sdo.CharacterObject"; - - public static final Type DATE = TYPE_HELPER.getType("commonj.sdo", "Date"); - public static final String DATE_STR = "commonj.sdo.Date"; - - public static final Type DATETIME = TYPE_HELPER.getType("commonj.sdo", "DateTime"); - public static final String DATETIME_STR = "commonj.sdo.DateTime"; - - public static final Type DAY = TYPE_HELPER.getType("commonj.sdo", "Day"); - public static final String DAY_STR = "commonj.sdo.Day"; - - public static final Type DECIMAL = TYPE_HELPER.getType("commonj.sdo", "Decimal"); - public static final String DECIMAL_STR = "commonj.sdo.Decimal"; - - public static final Type DOUBLE = TYPE_HELPER.getType("commonj.sdo", "Double"); - public static final String DOUBLE_STR = "commonj.sdo.Double"; - - public static final Type DOUBLEOBJECT = TYPE_HELPER.getType("commonj.sdo", "DoubleObject"); - public static final String DOUBLEOBJECT_STR = "commonj.sdo.DoubleObject"; - - public static final Type DURATION = TYPE_HELPER.getType("commonj.sdo", "Duration"); - public static final String DURATION_STR = "commonj.sdo.Duration"; - - public static final Type FLOAT = TYPE_HELPER.getType("commonj.sdo", "Float"); - public static final String FLOAT_STR = "commonj.sdo.Float"; - - public static final Type FLOATOBJECT = TYPE_HELPER.getType("commonj.sdo", "FloatObject"); - public static final String FLOATOBJECT_STR = "commonj.sdo.FloatObject"; - - public static final Type INT = TYPE_HELPER.getType("commonj.sdo", "Int"); - public static final String INT_STR = "commonj.sdo.Int"; - - public static final Type INTEGER = TYPE_HELPER.getType("commonj.sdo", "Integer"); - public static final String INTEGER_STR = "commonj.sdo.Integer"; - - public static final Type INTOBJECT = TYPE_HELPER.getType("commonj.sdo", "IntObject"); - public static final String INTOBJECT_STR = "commonj.sdo.IntObject"; - - public static final Type LONG = TYPE_HELPER.getType("commonj.sdo", "Long"); - public static final String LONG_STR = "commonj.sdo.Long"; - - public static final Type LONGOBJECT = TYPE_HELPER.getType("commonj.sdo", "LongObject"); - public static final String LONGOBJECT_STR = "commonj.sdo.LongObject"; - - public static final Type MONTH = TYPE_HELPER.getType("commonj.sdo", "Month"); - public static final String MONTH_STR = "commonj.sdo.Month"; - - public static final Type MONTHDAY = TYPE_HELPER.getType("commonj.sdo", "MonthDay"); - public static final String MONTHDAY_STR = "commonj.sdo.MonthDay"; - - public static final Type OBJECT = TYPE_HELPER.getType("commonj.sdo", "Object"); - public static final String OBJECT_STR = "commonj.sdo.Object"; - - public static final Type SHORT = TYPE_HELPER.getType("commonj.sdo", "Short"); - public static final String SHORT_STR = "commonj.sdo.Short"; - - public static final Type SHORTOBJECT = TYPE_HELPER.getType("commonj.sdo", "ShortObject"); - public static final String SHORTOBJECT_STR = "commonj.sdo.ShortObject"; - - public static final Type STRING = TYPE_HELPER.getType("commonj.sdo", "String"); - public static final String STRING_STR = "commonj.sdo.String"; - - public static final Type STRINGS = TYPE_HELPER.getType("commonj.sdo", "Strings"); - public static final String STRINGS_STR = "commonj.sdo.Strings"; - - public static final Type TIME = TYPE_HELPER.getType("commonj.sdo", "Time"); - public static final String TIME_STR = "commonj.sdo.Time"; - - public static final Type URI = TYPE_HELPER.getType("commonj.sdo", "URI"); - public static final String URI_STR = "commonj.sdo.URI"; - - public static final Type YEAR = TYPE_HELPER.getType("commonj.sdo", "Year"); - public static final String YEAR_STR = "commonj.sdo.Year"; - - public static final Type YEARMONTH = TYPE_HELPER.getType("commonj.sdo", "YearMonth"); - public static final String YEARMONTH_STR = "commonj.sdo.YearMonth"; - - public static final Type YEARMONTHDAY = TYPE_HELPER.getType("commonj.sdo", "YearMonthDay"); - public static final String YEARMONTHDAY_STR = "commonj.sdo.YearMonthDay"; -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SPCommandImpl.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SPCommandImpl.java deleted file mode 100644 index c1822c3e07..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SPCommandImpl.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.Iterator; -import java.util.List; - -import org.apache.log4j.Logger; -import org.apache.tuscany.das.rdb.config.Parameter; -import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; - -import commonj.sdo.DataObject; -import commonj.sdo.Type; -import commonj.sdo.helper.TypeHelper; - -public class SPCommandImpl extends ReadCommandImpl { - private final Logger logger = Logger.getLogger(SPCommandImpl.class); - - public SPCommandImpl(String sqlString, MappingWrapper config, List params) { - super(sqlString, config, null); - Iterator i = params.iterator(); - while (i.hasNext()) { - 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); - - String direction = ParameterExtendedImpl.IN; - if (ParameterExtendedImpl.OUT.equalsIgnoreCase(p.getDirection())) { - direction = ParameterExtendedImpl.OUT; - } else if (ParameterExtendedImpl.IN_OUT.equalsIgnoreCase(p.getDirection())) { - direction = ParameterExtendedImpl.IN_OUT; - } - parameters.findOrCreateParameterWithIndex(p.getIndex(), direction, sdoType); - } - - } - - public DataObject executeQuery() { - - boolean success = false; - try { - List results = statement.executeCall(parameters); - success = true; - - return buildGraph(results); - } catch (SQLException e) { - if (this.logger.isDebugEnabled()) { - this.logger.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/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Statement.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Statement.java deleted file mode 100644 index bae802a2bc..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Statement.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import org.apache.log4j.Logger; - -// TODO - Can use some refactoring. Much code is duplicated in "execute" methods -public class Statement { - - protected final String queryString; - - protected ConnectionImpl jdbcConnection; - - private final Logger logger = Logger.getLogger(Statement.class); - - private PreparedStatement preparedStatement; - - private boolean isPaging; - - public Statement(String sqlString) { - this.queryString = sqlString; - } - - public List executeQuery(ParametersExtendedImpl parameters) throws SQLException { - - PreparedStatement ps = getPreparedStatement(new String[0]); - ps = setParameters(ps, parameters); - ResultSet rs = ps.executeQuery(); - - return Collections.singletonList(rs); - } - - public List executeCall(ParametersExtendedImpl parameters) throws SQLException { - - CallableStatement cs = jdbcConnection.prepareCall(queryString); - - Iterator inParams = parameters.getInParameters().iterator(); - while (inParams.hasNext()) { - ParameterExtendedImpl param = (ParameterExtendedImpl) inParams.next(); - cs.setObject(param.getIndex(), param.getValue()); - } - - // register out parameters - Iterator outParams = parameters.getOutParameters().iterator(); - while (outParams.hasNext()) { - ParameterExtendedImpl param = (ParameterExtendedImpl) outParams.next(); - if (this.logger.isDebugEnabled()) { - this.logger.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(); - List results = new ArrayList(); - results.add(cs.getResultSet()); - while (cs.getMoreResults(java.sql.Statement.KEEP_CURRENT_RESULT)) { - results.add(cs.getResultSet()); - } - - Iterator i = parameters.getOutParameters().iterator(); - while (i.hasNext()) { - ParameterExtendedImpl param = (ParameterExtendedImpl) i.next(); - param.setValue(cs.getObject(param.getIndex())); - } - - return results; - - } - - public void executeUpdateCall(ParametersExtendedImpl parameters) throws SQLException { - CallableStatement cs = jdbcConnection.prepareCall(queryString); - - Iterator inParams = parameters.getInParameters().iterator(); - while (inParams.hasNext()) { - ParameterExtendedImpl param = (ParameterExtendedImpl) inParams.next(); - cs.setObject(param.getIndex(), param.getValue()); - } - - // register out parameters - Iterator outParams = parameters.getOutParameters().iterator(); - while (outParams.hasNext()) { - ParameterExtendedImpl param = (ParameterExtendedImpl) outParams.next(); - - if (this.logger.isDebugEnabled()) { - this.logger.debug("Registering parameter " + param.getName()); - } - - cs.registerOutParameter(param.getIndex(), SDODataTypeHelper.sqlTypeFor(param.getType())); - } - - cs.execute(); - - Iterator out = parameters.getOutParameters().iterator(); - while (out.hasNext()) { - ParameterExtendedImpl param = (ParameterExtendedImpl) out.next(); - param.setValue(cs.getObject(param.getIndex())); - } - - } - - public int executeUpdate(ParametersExtendedImpl parameters, String[] generatedKeys) throws SQLException { - return executeUpdate(getPreparedStatement(generatedKeys), parameters); - } - - public int executeUpdate(ParametersExtendedImpl parameters) throws SQLException { - return executeUpdate(parameters, new String[0]); - } - - /** - * TODO - We need to look at using specific ps.setXXX methods when a type - * has been specified and try setObject otherwise. - */ - private int executeUpdate(PreparedStatement ps, ParametersExtendedImpl parameters) throws SQLException { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Executing statement " + queryString); - } - - Iterator i = parameters.getInParameters().iterator(); - while (i.hasNext()) { - ParameterExtendedImpl param = (ParameterExtendedImpl) i.next(); - - Object value = param.getValue(); - if (this.logger.isDebugEnabled()) { - this.logger.debug("Setting parameter " + param.getIndex() + " to " + value); - } - - if (value == null) { - if (param.getType() == null) { - try { - ParameterMetaData pmd = ps.getParameterMetaData(); - ps.setNull(param.getIndex(), pmd.getParameterType(param.getIndex())); - } catch (SQLException ex) { - ps.setNull(param.getIndex(), SDODataTypeHelper.sqlTypeFor(null)); - } - } else { - ps.setNull(param.getIndex(), SDODataTypeHelper.sqlTypeFor(param.getType())); - } - } else { - ps.setObject(param.getIndex(), value); - } - } - return ps.executeUpdate(); - } - - protected PreparedStatement setParameters(PreparedStatement ps, ParametersExtendedImpl parameters) throws SQLException { - Iterator i = parameters.getInParameters().iterator(); - while (i.hasNext()) { - ParameterExtendedImpl param = (ParameterExtendedImpl) i.next(); - 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(String[] returnKeys) throws SQLException { - - if (preparedStatement == null) { - if (isPaging) { - preparedStatement = jdbcConnection.preparePagedStatement(queryString); - } else { - preparedStatement = jdbcConnection.prepareStatement(queryString, returnKeys); - } - } - - return preparedStatement; - } - - public Integer getGeneratedKey() throws SQLException { - - if (getConnection().isGeneratedKeysSupported()) { - ResultSet rs = preparedStatement.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/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateCommandImpl.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateCommandImpl.java deleted file mode 100644 index 4155360341..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateCommandImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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(org.apache.tuscany.das.rdb.config.Command command) { - super(command); - } - - public UpdateCommandImpl(String sqlString) { - super(sqlString); - } - - public UpdateCommandImpl(Update update) { - super(update.getSql()); - this.addParameters(update.getParameters()); - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateList.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateList.java deleted file mode 100644 index e7bb58698c..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateList.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.List; - -/** - * Updates don't have to be sorted, so this class is a simple wrapper of ArrayList. - * - */ -public class UpdateList { - - private List updates = new ArrayList(); - - public UpdateList() { - super(); - } - - public void add(ChangeOperation c) { - updates.add(c); - } - - public Collection getSortedList() { - return updates; - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateOperation.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateOperation.java deleted file mode 100644 index 1bcf3441b6..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateOperation.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/WriteCommandImpl.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/WriteCommandImpl.java deleted file mode 100644 index ee3f3d8faa..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/WriteCommandImpl.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.OutputStream; -import java.sql.SQLException; -import java.util.List; -import java.util.TreeMap; - -import org.apache.tuscany.das.rdb.config.Config; -import org.apache.tuscany.das.rdb.config.Parameters; -import org.apache.tuscany.das.rdb.config.ResultDescriptor; -import org.apache.tuscany.das.rdb.config.impl.ParameterImpl; - -import commonj.sdo.DataObject; - -public abstract class WriteCommandImpl extends CommandImpl { - - public WriteCommandImpl(org.apache.tuscany.das.rdb.config.Command command) { - super(command); - } - - public WriteCommandImpl(String sqlString) { - super(sqlString); - } - - public void setResultDescriptors(List resultDescriptorList){ - //ignore , applicable for ReadCommand only - } - - public List getResultDescriptors(){ - //ignore, applicable for ReadCommand only - return null; - } - - public void addResultDescriptor(ResultDescriptor resultDescriptor){ - //ignore - } - - - public ResultDescriptor removeResultDescriptor(int index){ - return null; - } - - public ResultDescriptor removeResultDescriptor(ResultDescriptor resultDescriptor){ - return null; - } - - public ResultDescriptor getResultDescriptor(int index){ - return null; - } - - public void printResultDescriptors(OutputStream ostrm) throws IOException{ - //ignore - } - - public void execute() { - - boolean success = false; - try { - basicExecute(); - success = true; - } finally { - if (success) { - statement.getConnection().cleanUp(); - } else { - statement.getConnection().errorCleanUp(); - } - } - - } - - public void basicExecute() { - try { - statement.executeUpdate(parameters); - } catch (SQLException e) { - throw new RuntimeException(e); - } - } - - public DataObject executeQuery() { - throw new UnsupportedOperationException(); - } - - public Config getMappingModel() { - return configWrapper.getConfig(); - } - - 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"); - } - - //it is acceptable if params having index set by caller are listed in any order in Parameters - //but, if index is not set by caller, the order of parameters in Parameters should be in sync - //with the Command string parameters - protected void addParameters(Parameters parameters) { - List params = parameters.getParameter(); - if(params == null) - return; - - boolean paramsIndexed = true; - TreeMap sortedParams = null; - for(int i=0; i -1) { - primaryGraph = (DataObject)graphs.remove(primaryIndex); - } - - Iterator i = graphs.iterator(); - if(primaryGraph == null) { - if (i.hasNext()) { - primaryGraph = (DataObject)i.next(); - } - } - - while (i.hasNext()) { - primaryGraph = merge(primaryGraph, (DataObject) i.next(), preservePrimaryChangeSummary); - } - - return primaryGraph; - } - - public DataObject merge(List graphs) { - return merge(graphs, true); - } - - public DataObject merge(DataObject primary, DataObject secondary, boolean preservePrimaryChangeSummary) { - Type rootType = createDataGraphRoot(); - DataObject root1 = null; - DataObject root2 = null; - - if(!isContainedWithChangeSummary(primary) && isContainedWithChangeSummary(secondary)) { - //swap as secondary has change history - DataObject temp = primary; - primary = secondary; - secondary = temp; - } - - //if primary top type name is not DataGraphRoot , add it - if(!isContainedWithChangeSummary(primary)) { - root1 = containWithChangeSummary(rootType, primary); - } else { - root1 = primary; - } - - //if secondary top type name is not DataGraphRoot , add it - if(!isContainedWithChangeSummary(secondary)) { - root2 = containWithChangeSummary(rootType, secondary); - } else { - root2 = secondary; - } - - return mergeContained(root1, root2, preservePrimaryChangeSummary); - } - - public DataObject merge(DataObject primary, DataObject secondary) { - return merge(primary, secondary, true); - } - - public DataObject mergeContained(DataObject primary, DataObject secondary, boolean preservePrimaryChangeSummary) { - addGraphToRegistry(primary); - - Iterator i = secondary.getType().getProperties().iterator(); - ChangeSummary summary = primary.getDataGraph().getChangeSummary(); - - if(preservePrimaryChangeSummary && summary.isLogging()) { - summary.endLogging(); - } - - 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); - } - } - - if(preservePrimaryChangeSummary && !summary.isLogging()) { - summary.beginLogging(); - } - - return primary; - } - - private void createObjectWithSubtree(DataObject root, Property p, DataObject object) { - Object pk = getPrimaryKey(object); - - if (!registry.contains(object.getType().getName(), Collections.singletonList(pk))) { - Iterator attrs = object.getType().getProperties().iterator(); - DataObject newObject = root.createDataObject(p.getName()); - - createDataProperties(attrs, newObject, object); - registry.put(object.getType().getName(), Collections.singletonList(pk), newObject); - createReferenceProperties(root, newObject, object); - } - - } - - private void createDataProperties(Iterator attrs, DataObject newObject, DataObject object) { - while (attrs.hasNext()) { - Property attr = (Property) attrs.next(); - if (attr.getType().isDataType()) { - try { - newObject.set(attr.getName(), object.get(attr)); - } catch(Exception e) { - throw new RuntimeException("Graph structures do not match, can not merge! " + attr.getName()); - } - } - } - } - - private void createReferenceProperties(DataObject root, DataObject newObject, DataObject object) { - 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)); - if (logger.isDebugEnabled()) { - logger.debug("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()); - } - - //JIRA-952 - //if the table and column have SDO type name and property name use it else use database table and column name - public void addPrimaryKey(String key) { - QualifiedColumn column = null; - if(this.config != null && this.config.isDatabaseSchemaNameSupported()){ - column = new QualifiedColumn(key, this.config.isDatabaseSchemaNameSupported()); - } - else{ - column = new QualifiedColumn(key); - } - - String tableName = column.getTableName(); - String columnName = column.getColumnName(); - String schemaName = column.getSchemaName(); - String qualifiedTableName = null; - - if(this.config != null && this.config.isDatabaseSchemaNameSupported()) { - qualifiedTableName = schemaName+"."+tableName; - } else { - qualifiedTableName = tableName; - } - MappingWrapper configWrapper = new MappingWrapper(this.config); - - String typeName = configWrapper.getTableTypeName(qualifiedTableName); - String propertyName = configWrapper.getColumnPropertyName(qualifiedTableName, columnName); - - if(typeName != null && propertyName != null) { - if (logger.isDebugEnabled()) { - logger.debug("Adding " + typeName + " " + propertyName + " to keys"); - } - keys.put(typeName, propertyName); - } else { - if (logger.isDebugEnabled()) { - logger.debug("Adding " + column.getTableName() + " " + column.getColumnName() + " to keys"); - } - keys.put(column.getTableName(), column.getColumnName()); - } - } -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/CollectionsUtil.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/CollectionsUtil.java deleted file mode 100644 index 64e8826f76..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/CollectionsUtil.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.Collection; -import java.util.Iterator; - -/** - */ -public final class CollectionsUtil { - - private CollectionsUtil() { - - } - - // Utilities - public static boolean disjoint(Collection c1, Collection c2) { - - if (c1.size() > c2.size()) { - Collection c = c1; - c1 = c2; - c2 = c; - } - for (Iterator iterator = c2.iterator(); iterator.hasNext();) { - Object o = (Object)iterator.next(); - if (c1.contains(o)) { - return false; - } - } - return true; - } - -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/ConfigUtil.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/ConfigUtil.java deleted file mode 100644 index c5c7a38aab..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/ConfigUtil.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.Iterator; -import java.util.List; - -import org.apache.tuscany.das.rdb.config.Command; -import org.apache.tuscany.das.rdb.config.Config; -import org.apache.tuscany.das.rdb.config.ConfigFactory; -import org.apache.tuscany.das.rdb.config.Create; -import org.apache.tuscany.das.rdb.config.Delete; -import org.apache.tuscany.das.rdb.config.Parameter; -import org.apache.tuscany.das.rdb.config.Update; - -import commonj.sdo.helper.HelperContext; -import commonj.sdo.helper.XMLHelper; -import commonj.sdo.impl.HelperProvider; - -/** - * Config util provides config-related utilities such as loading a Config - * instance from an InputStream - * - */ -public final class ConfigUtil { - - private 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"); - } - - HelperContext context = HelperProvider.getDefaultContext(); - ConfigFactory.INSTANCE.register(context); - XMLHelper helper = context.getXMLHelper(); - - try { - return (Config) helper.load(configStream).getRootObject(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public static String getParameters(Create createCommand) { - List parameters = createCommand.getParameters().getParameter(); - if(parameters != null) { - Iterator itr = parameters.iterator(); - StringBuffer serializedParameters = new StringBuffer(); - - while(itr.hasNext()) { - serializedParameters.append(((Parameter)itr.next()).getName()+" "); - } - return serializedParameters.toString().trim(); - } - else { - return null; - } - } - - public static String getParameters(Update updateCommand) { - List parameters = updateCommand.getParameters().getParameter(); - if(parameters != null) { - Iterator itr = parameters.iterator(); - StringBuffer serializedParameters = new StringBuffer(); - - while(itr.hasNext()) { - serializedParameters.append(((Parameter)itr.next()).getName()+" "); - } - return serializedParameters.toString().trim(); - } - else { - return null; - } - } - - public static String getParameters(Delete deleteCommand) { - List parameters = deleteCommand.getParameters().getParameter(); - if(parameters != null) { - Iterator itr = parameters.iterator(); - StringBuffer serializedParameters = new StringBuffer(); - - while(itr.hasNext()) { - serializedParameters.append(((Parameter)itr.next()).getName()+" "); - } - return serializedParameters.toString().trim(); - } - else { - return null; - } - } - - public static String getParameters(Command command) { - List parameters = command.getParameter(); - if(parameters != null) { - Iterator itr = parameters.iterator(); - StringBuffer serializedParameters = new StringBuffer(); - - while(itr.hasNext()) { - serializedParameters.append(((Parameter)itr.next()).getName()+" "); - } - return serializedParameters.toString().trim(); - } - else { - return null; - } - } -} diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DataObjectUtil.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DataObjectUtil.java deleted file mode 100644 index b9649669e5..0000000000 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DataObjectUtil.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 final class DataObjectUtil { - - private 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/java/das/rdb/src/main/resources/META-INF/DISCLAIMER b/java/das/rdb/src/main/resources/META-INF/DISCLAIMER deleted file mode 100644 index a65af91c5a..0000000000 --- a/java/das/rdb/src/main/resources/META-INF/DISCLAIMER +++ /dev/null @@ -1,7 +0,0 @@ -Apache Tuscany is an effort undergoing incubation at The Apache Software -Foundation (ASF), sponsored by the Apache 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. \ No newline at end of file diff --git a/java/das/rdb/src/main/resources/META-INF/LICENSE b/java/das/rdb/src/main/resources/META-INF/LICENSE deleted file mode 100644 index 9597d92eb3..0000000000 --- a/java/das/rdb/src/main/resources/META-INF/LICENSE +++ /dev/null @@ -1,353 +0,0 @@ - - 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. - -=============================================================================================================== - -Other components and dependencies under Apache Software License 2.0 : - - log4j-1.2.14.jar - Apache Logging Services - derby 10.2.2.0.jar - Apache Derby - stax-api-1.0.1.jar - The Streaming API for XML (StAX) - wstx-asl-3.2.0.jar - WoodStox StAX implementation - standard-1.1.1.jar - The Apache Jackarta Taglibs - jstl-1.1.2.jar - The Apache Jackarta Taglibs - *.tld - The Apache Jackarta Taglibs - -=============================================================================================================== - - -Apache Tuscany SDO for Java Subcomponents -=========================================: - -The Tuscany SDO for Java release 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. - -License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar) - -Permission to copy, make derivative works of, and distribute the Service Data Objects -JavaDoc and Interface Definition Files files in any medium without fee or royalty as part -of a compliant implementation of the Service Data Objects Specification is hereby granted. -The Service Data Objects Specification may be found at any of the following locations: - -http://dev2dev.bea.com/technologies/commonj/index.jsp -http://www.ibm.com/developerworks/library/specification/ws-sdo/ -http://oracle.com/technology/webservices/sca -https://www.sdn.sap.com/ -http://www.xcalia/xdn/specs/sdo - -THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES -ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS -SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS, -INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, -NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE -SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES. - -The name and trademarks of the Authors may NOT be used in any manner, including advertising or -publicity pertaining to the Service Component Architecture Specification or its contents without specific, -written prior permission. Title to copyright in the Service Data Objects Specification and the -JavaDoc and Interface Definition Files will at all times remain with the Authors. - -No other rights are granted by implication, estoppel or otherwise. - -================================================================================================================= - -For the Eclipse EMF components -(codegen-2.2.3.jar -codegen-ecore-2.2.3.jar -common-2.2.3.jar -ecore-2.2.3.jar -ecore-change-2.2.3.jar -ecore-xmi-2.2.3.jar -xsd-2.2.3.jar) - -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. - -=================================================================================================== diff --git a/java/das/rdb/src/main/resources/META-INF/NOTICE b/java/das/rdb/src/main/resources/META-INF/NOTICE deleted file mode 100644 index e9d98fc7f5..0000000000 --- a/java/das/rdb/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,32 +0,0 @@ -Apache Tuscany SDO for Java -Copyright 2006, 2007 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - -Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF), -sponsored by the Apache 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. - -Unless otherwise indicated, all distribution made available by the Apache Software Foundation -is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL"). -A copy of the AL is provided with this distribution as the LICENSE.txt file present in the -root directory, and is also available at http://www.apache.org/licenses/. - -The terms and conditions governing the distribution may refer to the AL or other license -agreements, notices or terms and conditions. Some of these other license agreements may -include (but are not limited to): - - . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html) - -It is your obligation to read and accept all such terms and conditions prior to use of the -distribution. If term or condition is provided, please contact the Apache Software Foundation -to determine what terms and conditions govern that particular distribution. - -This product also includes software developed by the Open Service Oriented Architecture organisation -(http://osoa.org). The license for this software may be found in the LICENSE.txt file contained in this -distribution. diff --git a/java/das/rdb/src/main/resources/META-INF/README b/java/das/rdb/src/main/resources/META-INF/README deleted file mode 100644 index 853d9546db..0000000000 --- a/java/das/rdb/src/main/resources/META-INF/README +++ /dev/null @@ -1,35 +0,0 @@ -Apache Tuscany DAS beta1 build (June, 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/java/das/rdb/src/main/resources/config.xsd b/java/das/rdb/src/main/resources/config.xsd deleted file mode 100644 index e48d01ed2a..0000000000 --- a/java/das/rdb/src/main/resources/config.xsd +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/das/rdb/src/main/resources/dasmodel4.mdl b/java/das/rdb/src/main/resources/dasmodel4.mdl deleted file mode 100644 index 476974975b..0000000000 --- a/java/das/rdb/src/main/resources/dasmodel4.mdl +++ /dev/null @@ -1,4622 +0,0 @@ - -(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/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/AliasTests.java b/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/AliasTests.java deleted file mode 100644 index eca81623d8..0000000000 --- a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/AliasTests.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.BookData; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -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(); - new CustomerData(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(); - bookToChange = null; - Iterator i = root.getList("Book").iterator(); - while (i.hasNext()) { - DataObject d = (DataObject) i.next(); - if ("Fyodor Dostoevskii".equals(d.getString("Writer"))) { - bookToChange = d; - } - } - assertFalse(bookToChange == null); - - 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")); - } - - /** - * 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")); - - } - - /** - * Test modify PK value - */ - public void testModifyPK() 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")); - - customer.setInt("id", 100); - das.applyChanges(root); - - select = das.createCommand("SELECT * FROM CUSTOMER WHERE CUSTOMER.ID = 100"); - root = select.executeQuery(); - customer = root.getDataObject("Customer[1]"); - assertEquals(100, customer.getInt("id")); - } -} diff --git a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/BestPracticeTests.java b/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/BestPracticeTests.java deleted file mode 100644 index 3a7c4560cb..0000000000 --- a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/BestPracticeTests.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 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(); - - Iterator i = root.getList("COMPANY").iterator(); - while (i.hasNext()) { - DataObject d = (DataObject) i.next(); - List departments = d.getList("departments"); - if (d.getString("NAME").equals("Do-rite plumbing") || d.getString("NAME").equals("ACME Publishing")) { - assertEquals(0, departments.size()); - } else { - assertEquals(1, 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("DEPNUMBER", "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/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CUDGeneration.java b/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CUDGeneration.java deleted file mode 100644 index 60b0d05ead..0000000000 --- a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CUDGeneration.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CheckSupportGeneratedKeys.java b/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CheckSupportGeneratedKeys.java deleted file mode 100644 index 8e3c983e63..0000000000 --- a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CheckSupportGeneratedKeys.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.config.Config; -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.framework.DasTest; - -import commonj.sdo.DataObject; - -public class CheckSupportGeneratedKeys extends DasTest { - protected void setUp() throws Exception { - super.setUp(); - - new CustomerData(getAutoConnection()).refresh();//no generated keys used - new CompanyData(getAutoConnection()).refresh();//generated keys used - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - // useGetGeneratedKeys set to TRUE - Company - public void testInsert() throws Exception { - ConfigHelper helper = new ConfigHelper(); - Config config = helper.getConfig(); - config.setGeneratedKeysSupported("true"); - - DAS das = DAS.FACTORY.createDAS(config, getConnection()); - Command insert = das.createCommand("insert into COMPANY (NAME) values (?)"); - insert.setParameter(1, "AAA Rental"); - insert.execute(); - Integer key = new 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")); - } - - // useGetGeneratedKeys not set - Company (should work as default TRUE) - public void testInsert1() throws Exception { - ConfigHelper helper = new ConfigHelper(); - Config config = helper.getConfig(); - - DAS das = DAS.FACTORY.createDAS(config, getConnection()); - Command insert = das.createCommand("insert into COMPANY (NAME) values (?)"); - insert.setParameter(1, "AAA Rental"); - insert.execute(); - Integer key = new 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")); - } - - // useGetGeneratedKeys set to FALSE - Company - - // exception as insert.getGen..Keys will throw RuntimeException - public void testInsert2() throws Exception { - ConfigHelper helper = new ConfigHelper(); - Config config = helper.getConfig(); - config.setGeneratedKeysSupported("false"); - - DAS das = DAS.FACTORY.createDAS(config, getConnection()); - Command insert = das.createCommand("insert into COMPANY (NAME) values (?)"); - insert.setParameter(1, "AAA Rental"); - insert.execute();//this will happen as table is created with proper clause - - try{ - Integer key = new Integer(insert.getGeneratedKey()); - fail("Should not be able to retrieve key "+key);//unexpected - }catch(RuntimeException e){ - //e.printStackTrace(); - assertTrue(true);//expected - } - } - - // useGetGeneratedKeys set to TRUE - Customer - flag should be ignored during insert - public void testInsert3() throws Exception { - ConfigHelper helper = new ConfigHelper(); - Config config = helper.getConfig(); - config.setGeneratedKeysSupported("true"); - - DAS das = DAS.FACTORY.createDAS(config, getConnection()); - Command insert = das.createCommand("insert into CUSTOMER (ID, LASTNAME, ADDRESS) values (?, ?, ?)"); - String key = "10"; - insert.setParameter(1, key); - insert.setParameter(2, "CUST10"); - insert.setParameter(3, "ADDR10"); - insert.execute(); - - // Verify insert - Command select = das.createCommand("Select ID, LASTNAME from CUSTOMER where ID = ?"); - select.setParameter(1, key); - DataObject root = select.executeQuery(); - assertEquals(key, root.get("CUSTOMER[1]/ID").toString()); - } - - // useGetGeneratedKeys set to FALSE - Customer, flag has no effect - public void testInsert4() throws Exception { - ConfigHelper helper = new ConfigHelper(); - Config config = helper.getConfig(); - config.setGeneratedKeysSupported("false"); - - DAS das = DAS.FACTORY.createDAS(config, getConnection()); - Command insert = das.createCommand("insert into CUSTOMER (ID, LASTNAME, ADDRESS) values (?, ?, ?)"); - String key = "10"; - insert.setParameter(1, key); - insert.setParameter(2, "CUST10"); - insert.setParameter(3, "ADDR10"); - insert.execute(); - try{ - Integer retkey = new Integer(insert.getGeneratedKey()); - fail("Should not be able to retrieve key "+retkey); - }catch(RuntimeException e){ - //e.printStackTrace(); - assertTrue(true);//expected - } - - // Verify insert - Command select = das.createCommand("Select ID, LASTNAME from CUSTOMER where ID = ?"); - select.setParameter(1, key); - DataObject root = select.executeQuery(); - assertEquals(key, root.get("CUSTOMER[1]/ID").toString()); - } - - // useGetGeneratedKeys not set - Customer - default TRUE is ignored - public void testInsert5() throws Exception { - ConfigHelper helper = new ConfigHelper(); - Config config = helper.getConfig(); - - DAS das = DAS.FACTORY.createDAS(config, getConnection()); - Command insert = das.createCommand("insert into CUSTOMER (ID, LASTNAME, ADDRESS) values (?, ?, ?)"); - String key = "10"; - insert.setParameter(1, key); - insert.setParameter(2, "CUST10"); - insert.setParameter(3, "ADDR10"); - insert.execute(); - - // Verify insert - Command select = das.createCommand("Select ID, LASTNAME from CUSTOMER where ID = ?"); - select.setParameter(1, key); - DataObject root = select.executeQuery(); - assertEquals(key, root.get("CUSTOMER[1]/ID").toString()); - } -} diff --git a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java b/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java deleted file mode 100644 index 5e7bf3976f..0000000000 --- a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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("CustomersOrdersConfig.xml"), getConnection()); - - Command read = das.getCommand("order by id"); - read.setParameter(1, new Integer(1)); - DataObject root = read.executeQuery(); - - assertEquals("recombobulator", root.getString("ANORDER[1]/PRODUCT")); - - } - - /** - * Specify connection properties in config. Add explicit update command - */ - public void testUpdate() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CustomersOrdersConfig.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/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java b/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java deleted file mode 100644 index 65c2e86592..0000000000 --- a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 commonj.sdo.DataObject; -import commonj.sdo.helper.HelperContext; -import commonj.sdo.impl.HelperProvider; - -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.ID, COMPANY.NAME, " - + "EMPLOYEE.ID, EMPLOYEE.NAME, EMPLOYEE.SN, EMPLOYEE.MANAGER, " - + "DEPARTMENT.ID, DEPARTMENT.NAME, DEPARTMENT.LOCATION, DEPARTMENT.DEPNUMBER 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()); - HelperContext context = HelperProvider.getDefaultContext(); - CompanyFactory.INSTANCE.register(context); - // Build the select command - Command selectCommand = das.createCommand("select COMPANY.ID, COMPANY.NAME, " - + "EMPLOYEE.ID, EMPLOYEE.NAME, EMPLOYEE.SN, EMPLOYEE.MANAGER, " - + "DEPARTMENT.ID, DEPARTMENT.NAME, DEPARTMENT.LOCATION, DEPARTMENT.DEPNUMBER 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()); - } - - /** - * Default database setup inserts 3 records in COMPANY. This test verifies that these records have auto-gen keys - * 1,2,3 and the new created record has auto-gen key 4 in COMPANY.ID - * @throws Exception - */ - public void testCreateAutoGenKeyStatic() throws Exception { - //get DAS and select command - DataObject root = null; - - DAS das = DAS.FACTORY.createDAS(getConfig("companyMappingWithConverters.xml"), getConnection()); - HelperContext context = HelperProvider.getDefaultContext(); - CompanyFactory.INSTANCE.register(context); - Command selectCommand = das.getCommand("AllCompanies"); - root = selectCommand.executeQuery(); - assertEquals(3, root.getList("CompanyType").size()); - //verify result - CompanyType company = (CompanyType) root.getList("CompanyType").get(0); - int startId = company.getId(); - assertEquals(startId, company.getId()); - assertEquals("ACME Publishing", company.getName()); - - company = (CompanyType) root.getList("CompanyType").get(1); - assertEquals(startId+1, company.getId()); - assertEquals("Do-rite plumbing", company.getName()); - - company = (CompanyType) root.getList("CompanyType").get(2); - assertEquals(startId+2, company.getId()); - assertEquals("MegaCorp", company.getName()); - - //create a new company. auto get keys set in config and supported in table creation statement - CompanyType newCompany = (CompanyType)root.createDataObject("CompanyType"); - newCompany.setName("MyNewCompany"); - das.applyChanges(root); - - assertEquals("MyNewCompany", newCompany.getName()); - assertEquals(startId+3, newCompany.getId()); - } - - public void testCreateAutoGenKeyDynamic() throws Exception { - //get DAS and select command - DataObject root = null; - - DAS das = DAS.FACTORY.createDAS(getConfig("basicCompanyDepartmentMapping.xml"), getConnection()); - Command selectCommand = das.createCommand("select * from COMPANY"); - root = selectCommand.executeQuery(); - assertEquals(3, root.getList("COMPANY").size()); - //verify result - DataObject company = (DataObject)root.getList("COMPANY").get(0); - int startId = company.getInt("ID"); - assertEquals(startId, company.getInt("ID")); - assertEquals("ACME Publishing", company.getString("NAME")); - - company = (DataObject)root.getList("COMPANY").get(1); - assertEquals(startId+1, company.getInt("ID")); - assertEquals("Do-rite plumbing", company.getString("NAME")); - - company = (DataObject)root.getList("COMPANY").get(2); - assertEquals(startId+2, company.getInt("ID")); - assertEquals("MegaCorp", company.getString("NAME")); - - //create a new company. auto get keys set in config and supported in table creation statement - DataObject newCompany = root.createDataObject("COMPANY"); - newCompany.setString("NAME", "MyNewCompany"); - das.applyChanges(root); - - assertEquals("MyNewCompany", newCompany.getString("NAME")); - assertEquals(startId+3, newCompany.getInt("ID")); - } -} diff --git a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyRelationshipTests.java b/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyRelationshipTests.java deleted file mode 100644 index 8bd3c2479a..0000000000 --- a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyRelationshipTests.java +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.Vector; - -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.config.Relationship; -import org.apache.tuscany.das.rdb.test.data.OrderDetailsData; -import org.apache.tuscany.das.rdb.test.data.OrderDetailsDescriptionData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class CompoundKeyRelationshipTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - //new OrderData(getAutoConnection()).refresh(); - //new ProductData(getAutoConnection()).refresh(); - new OrderDetailsData(getAutoConnection()).refresh(); - new OrderDetailsDescriptionData(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 ORDERDETAILS LEFT JOIN ORDERDETAILSDESC " - + "ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID AND " + - " ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID " + - " WHERE ORDERDETAILS.ORDERID = 1 AND ORDERDETAILS.PRODUCTID = 1"; - - DAS das = DAS.FACTORY.createDAS(getConfig("OrderDetailsAndDescription.xml"), getConnection()); - // Read some order details and related order details description - Command select = das.createCommand(statement); - - DataObject root = select.executeQuery(); - DataObject orderdetails = root.getDataObject("ORDERDETAILS[1]"); - - assertEquals(2, orderdetails.getList("orderDetailsDesc").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("OrderDetailsAndDescription.xml"), getConnection()); - // Read some order details and related order details descs - Command select = das - .createCommand("SELECT * FROM ORDERDETAILS LEFT JOIN ORDERDETAILSDESC ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID " + - " AND ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID"); - - DataObject root = select.executeQuery(); - - DataObject ordDet1 = root.getDataObject("ORDERDETAILS[1]"); - DataObject ordDet2 = root.getDataObject("ORDERDETAILS[2]"); - - // Save IDs - Integer ord1ID = (Integer) ordDet1.get("ORDERID"); - Integer prod1ID = (Integer) ordDet1.get("PRODUCTID"); - - Integer ord2ID = (Integer) ordDet2.get("ORDERID"); - Integer prod2ID = (Integer) ordDet2.get("PRODUCTID"); - - // save order count - Integer order1DetDescCount = new Integer(ordDet1.getList("orderDetailsDesc").size()); - Integer order2DetDescCount = new Integer(ordDet2.getList("orderDetailsDesc").size()); - - // Move an order detail desc to ord det1 from ord det2 - DataObject orderDetailsDesc = (DataObject) ordDet2.getList("orderDetailsDesc").get(0); - ordDet1.getList("orderDetailsDesc").add(orderDetailsDesc); - - // Flush changes - das.applyChanges(root); - - // verify ord det1 relationship updates - select = das - .createCommand("SELECT * FROM ORDERDETAILS LEFT JOIN ORDERDETAILSDESC ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID " + - " AND ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID where ORDERDETAILS.ORDERID = ? AND ORDERDETAILS.PRODUCTID = ?"); - select.setParameter(1, ord1ID); - select.setParameter(2, prod1ID); - - root = select.executeQuery(); - assertEquals(order1DetDescCount.intValue() + 1, root.getList("ORDERDETAILS[1]/orderDetailsDesc").size()); - - // verify ord det2 relationship updates - select.setParameter(1, ord2ID); - select.setParameter(2, prod2ID); - - root = select.executeQuery(); - assertEquals(order2DetDescCount.intValue() - 1, root.getList("ORDERDETAILS[1]/orderDetailsDesc").size()); - } - - public void testFKBehavior() throws SQLException { - DAS das = DAS.FACTORY.createDAS(getConfig("OrderDetailsAndDescription.xml"), getConnection()); - // Read some order details and related order details descs - Command select = das - .createCommand("SELECT * FROM ORDERDETAILS LEFT JOIN ORDERDETAILSDESC ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID " + - " AND ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID"); - - DataObject root = select.executeQuery(); - - DataObject ordDet1 = root.getDataObject("ORDERDETAILS[1]"); - DataObject ordDet2 = root.getDataObject("ORDERDETAILS[2]"); - - // Save IDs - Integer ord1ID = (Integer) ordDet1.get("ORDERID"); - Integer prod1ID = (Integer) ordDet1.get("PRODUCTID"); - - // Move an order det desc to ord det1 from ord det2 - DataObject orderDetDesc = (DataObject) ordDet2.getList("orderDetailsDesc").get(0); - ordDet1.getList("orderDetailsDesc").add(orderDetDesc); - orderDetDesc.setInt("ORDERID", ord1ID.intValue()); - - try { - das.applyChanges(root); - fail("An exception should be thrown"); - } catch (RuntimeException ex) { - assertEquals("Foreign key properties should not be set when the corresponding relationship has changed", ex.getMessage()); - } - - } - - public void testFKBehavior2() throws SQLException { - DAS das = DAS.FACTORY.createDAS(getConfig("OrderDetailsAndDescription.xml"), getConnection()); - // Read some order details and related order details descs - Command select = das - .createCommand("SELECT * FROM ORDERDETAILS LEFT JOIN ORDERDETAILSDESC ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID " + - " AND ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID"); - - DataObject root = select.executeQuery(); - - DataObject ordDet1 = root.getDataObject("ORDERDETAILS[1]"); - DataObject ordDet2 = root.getDataObject("ORDERDETAILS[2]"); - - // Save IDs - Integer ord1ID = (Integer) ordDet1.get("ORDERID"); - Integer prod1ID = (Integer) ordDet1.get("PRODUCTID"); - - // Create an order det desc for ord det1 - DataObject orderDetDesc = root.createDataObject("ORDERDETAILSDESC"); - orderDetDesc.setInt("ID", 500); - orderDetDesc.setInt("ORDERID", ord1ID.intValue()); - ordDet1.getList("orderDetailsDesc").add(orderDetDesc); - - try { - das.applyChanges(root); - fail("An exception should be thrown"); - } catch (RuntimeException ex) { - assertEquals("Foreign key properties should not be set when the corresponding relationship has changed", ex.getMessage()); - } - } - - //add relationship through config helper - public void testValidFKColumn() throws SQLException { - ConfigHelper helper = new ConfigHelper(); - Vector parentColumnNames = new Vector(); - Vector childColumnNames = new Vector(); - - parentColumnNames.add(0, "ORDERDETAILS.ORDERID"); - parentColumnNames.add(1, "ORDERDETAILS.PRODUCTID"); - - childColumnNames.add(0, "ORDERDETAILSDESC.ORDERID"); - childColumnNames.add(1, "ORDERDETAILSDESC.PRODUCTID"); - - Relationship r = helper.addRelationship(parentColumnNames, childColumnNames); - - DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection()); - Command select = das.createCommand("SELECT * FROM ORDERDETAILS LEFT JOIN ORDERDETAILSDESC ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID " + - " AND ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID"); - - DataObject root = select.executeQuery(); - DataObject ordDet1 = root.getDataObject("ORDERDETAILS[1]"); - int order1DetDescCount = ordDet1.getList("ORDERDETAILSDESC").size(); - - DataObject orderDetDesc = root.createDataObject("ORDERDETAILSDESC"); - orderDetDesc.setInt("ID", 500); - - if(ordDet1 == null) System.out.println("order det1 is null"); - if(ordDet1.getList("ORDERDETAILSDESC") == null)System.out.println("list is null"); - - ordDet1.getList("ORDERDETAILSDESC").add(orderDetDesc); - try { - das.applyChanges(root); - - select = das.createCommand("SELECT * FROM ORDERDETAILS LEFT JOIN ORDERDETAILSDESC ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID " + - " AND ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID"); - - int modOrder1DetDescCount = select.executeQuery(). - getDataObject("ORDERDETAILS[1]").getList("ORDERDETAILSDESC").size(); - this.assertEquals(modOrder1DetDescCount, order1DetDescCount+1); - } catch (RuntimeException ex) { - fail("Exception was not expected:DETAILS:"+ ex.getMessage()); - } - } - - //add invalid relationship through config helper using invalid FK column name - public void testInvalidFKColumn() throws SQLException { - ConfigHelper helper = new ConfigHelper(); - Vector parentColumnNames = new Vector(); - Vector childColumnNames = new Vector(); - - parentColumnNames.add(0, "ORDERDETAILS.ORDERID"); - parentColumnNames.add(1, "ORDERDETAILS.PRODUCTID"); - - childColumnNames.add(0, "ORDERDETAILSDESC.ORDERID_INVALID"); - childColumnNames.add(1, "ORDERDETAILSDESC.PRODUCTID"); - - Relationship r = helper.addRelationship(parentColumnNames, childColumnNames); - - DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection()); - Command select = das.createCommand("SELECT * FROM ORDERDETAILS LEFT JOIN ORDERDETAILSDESC ON ORDERDETAILS.ORDERID = ORDERDETAILSDESC.ORDERID " + - " AND ORDERDETAILS.PRODUCTID = ORDERDETAILSDESC.PRODUCTID"); - - DataObject root = select.executeQuery(); - DataObject ordDet1 = root.getDataObject("ORDERDETAILS[1]"); - int order1DetDescCount = ordDet1.getList("ORDERDETAILSDESC").size(); - - DataObject orderDetDesc = root.createDataObject("ORDERDETAILSDESC"); - orderDetDesc.setInt("ID", 500); - - if(ordDet1 == null) System.out.println("order det1 is null"); - if(ordDet1.getList("ORDERDETAILSDESC") == null)System.out.println("list is null"); - - ordDet1.getList("ORDERDETAILSDESC").add(orderDetDesc); - try { - das.applyChanges(root); - fail("Exception was expected"); - } catch (RuntimeException ex) { - assertEquals("Invalid foreign key column: ORDERID_INVALID", ex.getMessage()); - } - } -} diff --git a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyTests.java b/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyTests.java deleted file mode 100644 index db8a59e638..0000000000 --- a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyTests.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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()); - - } - - public void testReadAndDelete() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("OrdersOrderDetailsConfig.xml"), 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]"); - orderDetail.delete(); - das.applyChanges(root); - - } -} diff --git a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConnectionTests.java b/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConnectionTests.java deleted file mode 100644 index 42ff57b831..0000000000 --- a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConnectionTests.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.sql.Statement; -import java.util.Properties; - -import org.apache.derby.jdbc.EmbeddedDataSource; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -/** - * Test Database Connection with and without authentication required - */ -public class ConnectionTests extends DasTest { - Properties p = null; - - protected void setUp() throws Exception { - super.setUp(); - p = System.getProperties(); - p.put("derby.system.home", "target"); - - EmbeddedDataSource ds = new EmbeddedDataSource(); - ds.setDatabaseName("dastestcon"); - ds.setDataSourceName("java/dastestcon"); - ds.setCreateDatabase("create"); - ds.setUser("dasuser"); - ds.setPassword("dasuser"); - Connection connection = ds.getConnection("dasuser", "dasuser");//to actually create the database - Statement stmt = connection.createStatement(); - try{ - stmt.executeQuery("select * from BOOK"); - } catch(Exception e) { - stmt.execute("create table BOOK (id int, name varchar(30))"); - stmt.execute("insert into BOOK values (1, 'book1')"); - } - connection.commit(); - connection.close(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * As database is created with user, password, connection without same authentication can not look up data - */ - public void testConnectionUsingDriverManagerNoAuth() throws Exception { - try { - DAS das = DAS.FACTORY.createDAS(getConfig("connectionInfoDriverManagerNoAuth.xml")); - das.getCommand("getBook").executeQuery(); - fail("Expected exception, as DB is created with id, pwd, needs same to get data from DB!"); - } catch(Exception e) { - assertTrue(true);//Expected exception - } - } - - /** - * As database is created with user, password, connection with same authentication can look up data - */ - public void testConnectionUsingDriverManagerAuth() throws Exception { - try { - DAS das = DAS.FACTORY.createDAS(getConfig("connectionInfoDriverManagerAuth.xml")); - DataObject root = das.getCommand("getBook").executeQuery(); - assertEquals(1, root.getList("BOOK").size()); - } catch(Exception e) { - fail("Expected DAS to obtain authenticated connection using data source!"); - } - } -} diff --git a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java b/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java deleted file mode 100644 index b300b85192..0000000000 --- a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.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 commonj.sdo.DataObject; -import commonj.sdo.helper.HelperContext; -import commonj.sdo.impl.HelperProvider; -/** - * Tests the Converter framwork - */ -public class ConverterTests extends DasTest { - - private static DateFormat myformat = new SimpleDateFormat("yyyy.MM.dd"); - - private static Date kbday; - - private static Date tbday; - - protected void setUp() throws Exception { - super.setUp(); - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - 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")); - - } - - public void testInvalidConverter1() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("InvalidConverter.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 - try { - select.executeQuery(); - } catch (Exception ex) { - assertEquals("java.lang.ClassNotFoundException: not.a.valid.class", ex.getMessage()); - } - - } - - public void testInvalidConverter2() throws Exception { - - HelperContext context = HelperProvider.getDefaultContext(); - CustomerFactory.INSTANCE.register(context); - DAS das = DAS.FACTORY.createDAS(getConfig("InvalidConverter.xml"), getConnection()); - - // Build the select command to read a specific customer and related - // orders - Command select = das.createCommand("SELECT * FROM ANORDER"); - - // Get the graph - - DataObject root = select.executeQuery(); - DataObject order = root.getDataObject("AnOrder[1]"); - - Customer customer = (Customer) root.createDataObject("Customer"); - customer.setID(700); - customer.setLastName("Daniel"); - customer.setAddress("an address"); - - customer.getOrders().add(order); - - try { - das.applyChanges(root); - } catch (Exception ex) { - assertEquals("java.lang.ClassNotFoundException: not.a.valid.class", ex.getMessage()); - } - - } - - /** - * This tests the use of a converter that does not produce a new "type". Instead it - * modifies the original value before storing to the database. In this exampe, the - * converter restores the original value on read. - * - * This is illustrated by obfuscating the lastname value before it is stored to the database and - * deobfuscating on read. - * - */ - public void testConverter3() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("CustomerConfigWithConverter2.xml"), getConnection()); - - // Create and initialize command to read customers - Command read = das.getCommand("getFirstCustomer"); - - // Read - DataObject root = read.executeQuery(); - - //Modify - root.setString("CUSTOMER[1]/LASTNAME", "Some new name"); - - das.applyChanges(root); - - // Read - root = read.executeQuery(); - - // Verify that I can read back the deobfuscated value - assertEquals("Some new name", root.getString("CUSTOMER[1]/LASTNAME")); - - //Now read directly without applying the converter to ensure that the value was obfuscated - //in the database. - DAS das2 = DAS.FACTORY.createDAS(getConnection()); - Command directRead = das2.createCommand("select * from CUSTOMER where ID = 1"); - root = directRead.executeQuery(); - - assertEquals("Fbzr arj anzr", root.getString("CUSTOMER[1]/LASTNAME")); - assertEquals(obfuscate("Some new name"), root.getString("CUSTOMER[1]/LASTNAME")); - - } - - // Utilities - - private String obfuscate (String original) throws Exception { - return toRot13(original); - } - - private String deobfuscate (String obfuscated) throws Exception { - return toRot13(obfuscated); - } - - //A simple, reversible, obfuscation algorithm using a ROT13 implementation - private String toRot13(String original) throws Exception { - - int abyte = 0; - byte[] buffer = original.getBytes("ISO-8859-1"); - - for (int i = 0; i < buffer.length; i++) { - abyte = buffer[i]; - int cap = abyte & 32; - abyte &= ~cap; - abyte = ((abyte >= 'A') && (abyte <= 'Z') ? ((abyte - 'A' + 13) % 26 + 'A') : abyte) | cap; - buffer[i] = (byte) abyte; - } - - return new String(buffer, "ISO-8859-1"); - } - -} diff --git a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java b/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java deleted file mode 100644 index 028861ed77..0000000000 --- a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.config.Table; -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(); - Table customerTable = helper.addTable("CUSTOMER", "CUSTOMER"); - helper.addUpdateStatement(customerTable, "update CUSTOMER set LASTNAME = ? where ID = ?", "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")); - - } - -} diff --git a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java b/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java deleted file mode 100644 index 3067d5ace7..0000000000 --- a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java +++ /dev/null @@ -1,405 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.config.Table; -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(); - } - - public void testDeleteAndCreate() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("basicCustomerMappingWithCUD2.xml"), getConnection()); - // Read customer 1 - Command select = das.createCommand("Select * from CUSTOMER"); - DataObject root = select.executeQuery(); - - DataObject customer = (DataObject) root.get("CUSTOMER[1]"); - - int customerId = customer.getInt("ID"); - // Modify customer - customer.delete(); - - DataObject newCustomer = root.createDataObject("CUSTOMER"); - newCustomer.setInt("ID", 9999); - newCustomer.setString("LASTNAME", "Jones"); - - // Build apply changes command - das.applyChanges(root); - - // Verify changes - root = select.executeQuery(); - boolean found = false; - Iterator i = root.getList("CUSTOMER").iterator(); - while (i.hasNext()) { - customer = (DataObject) i.next(); - assertFalse(customerId == customer.getInt("ID")); - if (customer.getInt("ID") == 9999) { - found = true; - } - } - - assertTrue(found); - - } - - /** - * 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(); - Table customerTable = helper.addTable("CUSTOMER", "CUSTOMER"); - helper.addUpdateStatement(customerTable, "update CUSTOMER set LASTNAME = ?, ADDRESS = ? " - + "where ID = ?", "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(); - assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); - - 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(); - assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); - - 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(); - assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); - - 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(); - assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); - - 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")); - - } - - /** - * Builds on previous but: 1. Uses a named command - */ - public void testReadModifyApply4() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("CustomerConfig.xml"), getConnection()); - // Read customer with particular ID - Command select = das.getCommand("getCustomer"); - select.setParameter(1, new Integer(1)); - DataObject root = select.executeQuery(); - assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); - - 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")); - - } - - public void testReadModifyApplyMultipleRows() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Verify pre-condition - Command select = das.createCommand("Select * from CUSTOMER"); - DataObject root = select.executeQuery(); - assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); - assertFalse(root.get("CUSTOMER[2]/LASTNAME").equals("Silva")); - - - // Read and modify customer 1 - DataObject customer1 = (DataObject) root.get("CUSTOMER[1]"); - customer1.set("LASTNAME", "Pavick"); - - // Read and modify customer 2 - DataObject customer2 = (DataObject) root.get("CUSTOMER[2]"); - customer2.set("LASTNAME", "Silva"); - - // Build apply changes command - das.applyChanges(root); - - // Verify changes - root = select.executeQuery(); - assertEquals("Pavick", root.getString("CUSTOMER[1]/LASTNAME")); - assertEquals("Silva", root.getString("CUSTOMER[2]/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 = getCustomerByLastName(root, "Daniel"); - 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, "Daniel")); - - } - - 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().indexOf("changed in the DataGraph but is not present in the Config") >= 0); - } - - } - - 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().indexOf("changed in the DataGraph but is not present in the Config") >= 0); - } - - } - - 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().indexOf("changed in the DataGraph but is not present in the Config") >= 0); - } - - } - - 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/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java b/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java deleted file mode 100644 index 4eb68c1404..0000000000 --- a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 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.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(); - new BookData(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 = 1"); - DataObject root = select.executeQuery(); - - assertEquals(1, root.getList("SERVERSTATUS").size()); - - } - - - /** - * Test expected failure when applyChanges processes DO with no PK columns. We - * should throw a better error than NPE - */ - - //now with JIRA-1464 , we will get exception in select itself , so can not reach upto - //applyChanges - /*public void testReadUpdateWithNoPKColumns() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("BooksConfig.xml"),getConnection()); - // Read a book instance - Command select = das.createCommand("SELECT NAME, AUTHOR, QUANTITY, OCC 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 the DO has no PK defined"); - } catch (NullPointerException ex) { - fail("We should do better than an NPE"); - } - }*/ - - -} diff --git a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DynamicResultDescriptorTests.java b/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DynamicResultDescriptorTests.java deleted file mode 100644 index d2535a2223..0000000000 --- a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DynamicResultDescriptorTests.java +++ /dev/null @@ -1,351 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.List; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.config.ConfigFactory; -import org.apache.tuscany.das.rdb.config.ResultDescriptor; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class DynamicResultDescriptorTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new CustomerData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Set result descriptor on Command dynamically - */ - public void testSetResultDescriptors() throws Exception { - ConfigFactory factory = ConfigFactory.INSTANCE; - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Read a customer - Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1"); - - List resultDescriptorList = new ArrayList(); - //as long as columnIndex is correct, order in ArrayList does not matter - ResultDescriptor desc3 = factory.createResultDescriptor(); - desc3.setColumnIndex(3); - desc3.setColumnName("ADDRESS"); - desc3.setColumnType("commonj.sdo.String"); - desc3.setTableName("CUSTOMER"); - - ResultDescriptor desc1 = factory.createResultDescriptor(); - desc1.setColumnIndex(1); - desc1.setColumnName("ID"); - desc1.setColumnType("commonj.sdo.Int"); - desc1.setTableName("CUSTOMER"); - - ResultDescriptor desc2 = factory.createResultDescriptor(); - desc2.setColumnIndex(2); - desc2.setColumnName("LASTNAME"); - desc2.setColumnType("commonj.sdo.String"); - desc2.setTableName("CUSTOMER"); - - resultDescriptorList.add(desc3); - resultDescriptorList.add(desc1); - resultDescriptorList.add(desc2); - - select.setResultDescriptors(resultDescriptorList); - DataObject root = select.executeQuery(); - assertEquals(1, root.getList("CUSTOMER").size()); - } - - /** - * Set a result descriptor on Command dynamically - * and later replace it with another invalid one, and check failure - */ - public void testReplaceResultDescriptors() throws Exception { - ConfigFactory factory = ConfigFactory.INSTANCE; - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Read a customer - Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1"); - - List resultDescriptorList = new ArrayList(); - //as long as columnIndex is correct, order in ArrayList does not matter - ResultDescriptor desc3 = factory.createResultDescriptor(); - desc3.setColumnIndex(3); - desc3.setColumnName("ADDRESS"); - desc3.setColumnType("commonj.sdo.String"); - desc3.setTableName("CUSTOMER"); - - ResultDescriptor desc1 = factory.createResultDescriptor(); - desc1.setColumnIndex(1); - desc1.setColumnName("ID"); - desc1.setColumnType("commonj.sdo.Int"); - desc1.setTableName("CUSTOMER"); - - ResultDescriptor desc2 = factory.createResultDescriptor(); - desc2.setColumnIndex(2); - desc2.setColumnName("LASTNAME"); - desc2.setColumnType("commonj.sdo.String"); - desc2.setTableName("CUSTOMER"); - - resultDescriptorList.add(desc3); - resultDescriptorList.add(desc1); - resultDescriptorList.add(desc2); - - select.setResultDescriptors(resultDescriptorList); - DataObject root = select.executeQuery(); - assertEquals(1, root.getList("CUSTOMER").size()); - - //Now use invalid one - resultDescriptorList.clear(); - - desc3.setColumnIndex(3); - desc3.setColumnName("ADDRESS"); - desc3.setColumnType("commonj.sdo.Int");//incompatible type - desc3.setTableName("CUSTOMER"); - - desc1.setColumnIndex(1); - desc1.setColumnName("ID"); - desc1.setColumnType("commonj.sdo.Int"); - desc1.setTableName("CUSTOMER"); - - desc2 = factory.createResultDescriptor(); - desc2.setColumnIndex(2); - desc2.setColumnName("LASTNAME"); - desc2.setColumnType("commonj.sdo.String"); - desc2.setTableName("CUSTOMER"); - - resultDescriptorList.add(desc3); - resultDescriptorList.add(desc2); - resultDescriptorList.add(desc1); - - select.setResultDescriptors(resultDescriptorList); - try{ - root = select.executeQuery(); - fail("Expected exception"); - }catch(Exception e){ - assertTrue(e instanceof ClassCastException); - } - } - - /** - * Set result descriptor on Command dynamically - * , overriding the one set from static config. - */ - public void testOverrideResultDescriptorsFromConfig() throws Exception { - ConfigFactory factory = ConfigFactory.INSTANCE; - DAS das = DAS.FACTORY.createDAS(getConfig("customerMappingWithResultDescriptor.xml"), getConnection()); - Command select = das.getCommand("testSelectCustomer"); - DataObject root = select.executeQuery(); - List custList = root.getList("CUSTOMER"); - assertEquals("Williams", ((DataObject)custList.get(0)).getString("LASTNAME")); - - List resultDescriptorList = new ArrayList(); - - ResultDescriptor desc3 = factory.createResultDescriptor(); - desc3.setColumnIndex(3); - desc3.setColumnName("ADDRESS"); - desc3.setColumnType("commonj.sdo.Int");//incompatible type - desc3.setTableName("CUSTOMER"); - - ResultDescriptor desc1 = factory.createResultDescriptor(); - desc1.setColumnIndex(1); - desc1.setColumnName("ID"); - desc1.setColumnType("commonj.sdo.Int"); - desc1.setTableName("CUSTOMER"); - - ResultDescriptor desc2 = factory.createResultDescriptor(); - desc2.setColumnIndex(2); - desc2.setColumnName("LASTNAME"); - desc2.setColumnType("commonj.sdo.String"); - desc2.setTableName("CUSTOMER"); - - resultDescriptorList.add(desc3); - resultDescriptorList.add(desc1); - resultDescriptorList.add(desc2); - - select.setResultDescriptors(resultDescriptorList); - try{ - select.executeQuery(); - fail("Expected exception"); - }catch(Exception e){ - assertTrue(e instanceof ClassCastException); - } - } - - /** - * Set null result descriptor on Command dynamically - */ - public void testNullResultDescriptors() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Read a customer - Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1"); - - List resultDescriptorList = null; - - try{ - select.setResultDescriptors(resultDescriptorList); - - select.executeQuery(); - this.assertTrue("Derby has DBMS metadata, so it will be used", true); - }catch(RuntimeException e){ - fail("Expected to succeed with no exception"); - } - } - - /** - * Set -ve columnIndex in result descriptor on Command dynamically - * Set will not be sorted and Type mismatch wi (Int and String for ID) - * will throw exception - */ - public void testNegativeIndexResultDescriptors() throws Exception { - ConfigFactory factory = ConfigFactory.INSTANCE; - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Read a customer - Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1"); - - List resultDescriptorList = new ArrayList(); - - ResultDescriptor desc3 = factory.createResultDescriptor(); - desc3.setColumnIndex(-3);//invalid - desc3.setColumnName("ADDRESS"); - desc3.setColumnType("commonj.sdo.String"); - desc3.setTableName("CUSTOMER"); - - ResultDescriptor desc1 = factory.createResultDescriptor(); - desc1.setColumnIndex(1); - desc1.setColumnName("ID"); - desc1.setColumnType("commonj.sdo.Int"); - desc1.setTableName("CUSTOMER"); - - ResultDescriptor desc2 = factory.createResultDescriptor(); - desc2.setColumnIndex(2); - desc2.setColumnName("LASTNAME"); - desc2.setColumnType("commonj.sdo.String"); - desc2.setTableName("CUSTOMER"); - - resultDescriptorList.add(desc3); - resultDescriptorList.add(desc1); - resultDescriptorList.add(desc2); - - try{ - select.setResultDescriptors(resultDescriptorList); - - select.executeQuery(); - fail("Expected exception"); - }catch(RuntimeException e){ - assertTrue("Exception as sorting wil not happen due to -ve columnIndex", true); - } - } - - /** - * Set matching columnIndices in result descriptor on Command dynamically - */ - public void testMatchingIndexResultDescriptor() throws Exception { - ConfigFactory factory = ConfigFactory.INSTANCE; - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Read a customer - Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1"); - - List resultDescriptorList = new ArrayList(); - - ResultDescriptor desc3 = factory.createResultDescriptor(); - desc3.setColumnIndex(1);//two times index is 1 - desc3.setColumnName("ADDRESS"); - desc3.setColumnType("commonj.sdo.String"); - desc3.setTableName("CUSTOMER"); - - ResultDescriptor desc1 = factory.createResultDescriptor(); - desc1.setColumnIndex(1); - desc1.setColumnName("ID"); - desc1.setColumnType("commonj.sdo.Int"); - desc1.setTableName("CUSTOMER"); - - ResultDescriptor desc2 = factory.createResultDescriptor(); - desc2.setColumnIndex(2); - desc2.setColumnName("LASTNAME"); - desc2.setColumnType("commonj.sdo.String"); - desc2.setTableName("CUSTOMER"); - - resultDescriptorList.add(desc3); - resultDescriptorList.add(desc1); - resultDescriptorList.add(desc2); - - try{ - select.setResultDescriptors(resultDescriptorList); - - select.executeQuery(); - fail("Expected exception"); - }catch(RuntimeException e){ - assertTrue(e.getMessage().indexOf("Two columns in Result Descriptor can not have same index")!= -1); - } - } - - public void testAddRemoveResultDescriptor() throws Exception { - ConfigFactory factory = ConfigFactory.INSTANCE; - - ResultDescriptor desc3 = factory.createResultDescriptor(); - desc3.setColumnIndex(3);//two times index is 1 - desc3.setColumnName("ADDRESS"); - desc3.setColumnType("commonj.sdo.String"); - desc3.setTableName("CUSTOMER"); - - ResultDescriptor desc1 = factory.createResultDescriptor(); - desc1.setColumnIndex(1); - desc1.setColumnName("ID"); - desc1.setColumnType("commonj.sdo.Int"); - desc1.setTableName("CUSTOMER"); - - ResultDescriptor desc2 = factory.createResultDescriptor(); - desc2.setColumnIndex(2); - desc2.setColumnName("LASTNAME"); - desc2.setColumnType("commonj.sdo.String"); - desc2.setTableName("CUSTOMER"); - - DAS das = DAS.FACTORY.createDAS(getConnection()); - // Read a customer - Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1"); - select.addResultDescriptor(desc3); - select.addResultDescriptor(desc1); - select.addResultDescriptor(desc2); - //select.printResultDescriptors(System.out); - assertEquals(1, ((ResultDescriptor)select.getResultDescriptors().get(0)).getColumnIndex()); - assertEquals(2, ((ResultDescriptor)select.getResultDescriptors().get(1)).getColumnIndex()); - assertEquals(3, ((ResultDescriptor)select.getResultDescriptors().get(2)).getColumnIndex()); - - select.removeResultDescriptor(2); - //select.printResultDescriptors(System.out); - assertEquals(1, ((ResultDescriptor)select.getResultDescriptors().get(0)).getColumnIndex()); - assertEquals(3, ((ResultDescriptor)select.getResultDescriptors().get(1)).getColumnIndex()); - - select.removeResultDescriptor(desc3); - //select.printResultDescriptors(System.out); - assertEquals(1, ((ResultDescriptor)select.getResultDescriptors().get(0)).getColumnIndex()); - - select.addResultDescriptor(null); - select.removeResultDescriptor(null); - //select.printResultDescriptors(System.out); - assertEquals(1, ((ResultDescriptor)select.getResultDescriptors().get(0)).getColumnIndex()); - } -} diff --git a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java b/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java deleted file mode 100644 index 4da0df87ae..0000000000 --- a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.sql.SQLException; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.test.companynoid.CompanynoidFactory; -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.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.data.OrderDetailsData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.helper.HelperContext; -import commonj.sdo.impl.HelperProvider; - -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(); - new CompanyData(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 { - HelperContext context = HelperProvider.getDefaultContext(); - CustomerFactory.INSTANCE.register(context); - 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()); - } - - } - - public void testMismatchedDataObjectModel() throws SQLException { - HelperContext context = HelperProvider.getDefaultContext(); - CompanynoidFactory.INSTANCE.register(context); - DAS das = DAS.FACTORY.createDAS(getConfig("companynoidMappingWithConverters.xml"), getConnection()); - Command read = das.createCommand("select * from company"); - try { - read.executeQuery(); - } catch (RuntimeException ex) { - assertEquals("Type CompanynoidType does not contain a property named ID", ex.getMessage()); - } - } - -} diff --git a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedCommandTests.java b/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedCommandTests.java deleted file mode 100644 index 45c83e6167..0000000000 --- a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedCommandTests.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedId.java b/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedId.java deleted file mode 100644 index ca8bd19868..0000000000 --- a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedId.java +++ /dev/null @@ -1,313 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 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.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 = new 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 insert into row with generated ID and generated insert - public void testInsert4() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"), getConnection()); - Command select = das.getCommand("all companies"); - DataObject root = select.executeQuery(); - - DataObject company = root.createDataObject("COMPANY"); - company.setString("NAME", "Phil's Tires"); - // This shouldn't do anything - company.setInt("ID", 999); - - das.applyChanges(root); - - // Verify insert - root = select.executeQuery(); - - assertEquals(4, root.getList("COMPANY").size()); - Iterator i = root.getList("COMPANY").iterator(); - while (i.hasNext()) { - DataObject comp = (DataObject) i.next(); - assertFalse(comp.getInt("ID") == 999); - } - - } - - /** - * Test insert into row with generated ID and no attributes set - */ - public void testInsert5() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"), getConnection()); - Command select = das.getCommand("all companies"); - DataObject root = select.executeQuery(); - - root.createDataObject("COMPANY"); - - das.applyChanges(root); - - // Verify insert - root = select.executeQuery(); - assertEquals(4, root.getList("COMPANY").size()); - - } - - - // 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("DEPNUMBER", "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("DEPNUMBER", "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()); - } - } - -} diff --git a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GraphMergeTests.java b/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GraphMergeTests.java deleted file mode 100644 index a1a7b57433..0000000000 --- a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GraphMergeTests.java +++ /dev/null @@ -1,625 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.List; - -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.config.wrapper.MappingWrapper; -import org.apache.tuscany.das.rdb.merge.impl.GraphMerger; -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.customer.impl.CustomerFactoryImpl; -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.SingerData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; -import org.apache.tuscany.das.rdb.test.singer.SINGER; -import org.apache.tuscany.das.rdb.test.singer.impl.SingerFactoryImpl; -import org.apache.tuscany.sdo.api.SDOUtil; - -import commonj.sdo.DataObject; -import commonj.sdo.Type; -import commonj.sdo.helper.DataFactory; -import commonj.sdo.helper.HelperContext; -import commonj.sdo.helper.TypeHelper; -import commonj.sdo.helper.XMLHelper; -import commonj.sdo.impl.HelperProvider; - -public class GraphMergeTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - new SingerData(getAutoConnection()).refresh(); - - } - - public void testCreateEmptyGraph() throws Exception { - String typeUri = "http:///org.apache.tuscany.das.rdb.test/customer.xsd"; - HelperContext context = HelperProvider.getDefaultContext(); - CustomerFactory.INSTANCE.register(context); - ConfigHelper helper = new ConfigHelper(); - helper.setDataObjectModel(typeUri); - DataObject graph = new GraphMerger().emptyGraph(helper.getConfig()); - assertEquals(0, graph.getList("Customer").size()); - assertEquals(0, graph.getList("AnOrder").size()); - - } - - public void testCreateEmptyGraphAndAddCustomer() throws Exception { - String typeUri = "http:///org.apache.tuscany.das.rdb.test/customer.xsd"; - HelperContext context = HelperProvider.getDefaultContext(); - CustomerFactory.INSTANCE.register(context); - ConfigHelper helper = new ConfigHelper(); - helper.setDataObjectModel(typeUri); - helper.addTable("CUSTOMER", "Customer"); - helper.addPrimaryKey("CUSTOMER.ID"); - - DataObject graph = new GraphMerger().emptyGraph(helper.getConfig()); - Customer c = (Customer) graph.createDataObject("Customer"); - c.setID(4000); - c.setLastName("Smith"); - c.setAddress("400 Fourth Street"); - - DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection()); - das.applyChanges(graph); - - Command cmd = das.createCommand("select * from CUSTOMER order by ID desc"); - graph = cmd.executeQuery(); - assertEquals(6, graph.getList("Customer").size()); - assertEquals("Smith", graph.getDataObject("Customer[1]").getString("lastName")); - assertEquals("400 Fourth Street", graph.getDataObject("Customer[1]").getString("address")); - - } - - 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); - List custList = mergedGraph.getList("CUSTOMER"); - for(int i=0; i ?"); - select2.setParameter(1, "3"); - DataObject graph2 = select2.executeQuery(); - assertEquals(2, graph2.getList("CUSTOMER").size()); - - GraphMerger merger = new GraphMerger(); - merger.addPrimaryKey("CUSTOMER.ID"); - DataObject mergedGraph = merger.merge(graph1, graph2); - List custList = mergedGraph.getList("CUSTOMER"); - for(int i=0; i0){ - assertTrue(true);//expected failure - } - } - } - - //join with both tables PKs present in SELECT, child row is complete null, outer join - public void testOuterJoin() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection()); - Command select = das.getCommand("testOuterJoin"); - DataObject root = select.executeQuery(); - List singers = root.getList("SINGER"); - List songs = root.getList("SONG");//as there is no relationship (explicit/implicit) - assertNotNull(singers); - assertEquals(1, singers.size()); - assertNotNull(songs); - assertEquals(0, songs.size()); - } - - //join with both tables' PKs present in SELECT - public void test11() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection()); - Command select = das.getCommand("test11"); - DataObject root = select.executeQuery(); - List owners = root.getList("OWNER"); - List dogs = root.getList("DOG");//as there is no relationship (explicit/implicit) - assertNotNull(owners); - assertNotNull(dogs); - for(int i=0; i0){ - assertTrue(true);//expected failure - } - } - } - - //join with child table's PK missing in SELECT - public void test33() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection()); - Command select = das.getCommand("test33"); - try{ - select.executeQuery(); - fail("Expected exception"); - }catch(RuntimeException e){ - if(e.getMessage(). - indexOf("in query does not include Primary Key "+ - "column or has null value in it, can not proceed!") >0){ - assertTrue(true);//expected failure - } - } - } - - //join with both tables' PK missing in SELECT - public void test44() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection()); - Command select = das.getCommand("test44"); - try{ - select.executeQuery(); - fail("Expected exception"); - }catch(RuntimeException e){ - if(e.getMessage(). - indexOf("in query does not include Primary Key "+ - "column or has null value in it, can not proceed!") >0){ - assertTrue(true);//expected failure - } - } - } - - //join with both tables' PK present in SELECT (use relationship) - public void test11_rel() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection()); - Command select = das.getCommand("test11"); - DataObject root = select.executeQuery(); - List owners = root.getList("OWNER"); - assertNotNull(owners); - assertEquals(3, owners.size()); - - if(owners != null){ - for(int i=0; i0){ - assertTrue(true);//expected failure - } - } - } - - //join with child table's PK missing in SELECT (use relationship) - public void test33_rel() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection()); - Command select = das.getCommand("test33"); - try{ - select.executeQuery(); - fail("Expected exception"); - }catch(RuntimeException e){ - if(e.getMessage(). - indexOf("in query does not include Primary Key "+ - "column or has null value in it, can not proceed!") >0){ - assertTrue(true);//expected failure - } - } - } - - //join with both tables' PK missing in SELECT (use relationship) - public void test44_rel() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection()); - Command select = das.getCommand("test44"); - try{ - select.executeQuery(); - fail("Expected exception"); - }catch(RuntimeException e){ - if(e.getMessage(). - indexOf("in query does not include Primary Key "+ - "column or has null value in it, can not proceed!") >0){ - assertTrue(true);//expected failure - } - } - } - - public void testCompoundPks() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection()); - Command select = das.getCommand("compound_pks"); - DataObject root = select.executeQuery(); - assertEquals(4, root.getList("ORDERDETAILS").size()); - } - - public void testCompoundPksFail() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection()); - Command select = das.getCommand("compound_pks_fail"); - try{ - select.executeQuery(); - fail("Expected exception"); - }catch(RuntimeException e){ - if(e.getMessage(). - indexOf("in query does not include Primary Key "+ - "column or has null value in it, can not proceed!") >0){ - assertTrue(true);//expected failure - } - } - } - - public void testCompoundPksJoin() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPKREL.xml"), getConnection()); - Command select = das.getCommand("compound_pks_join"); - DataObject root = select.executeQuery(); - List ordDetList = root.getList("ORDERDETAILS"); - assertEquals(4, ordDetList.size()); - for(int i=0; i0){ - assertTrue(true);//expected failure - } - } - } - - //case when no PK defined in Config but column ID is there in table and is not in SELECT clause - //convention over configuration should assume it as PK and fail select - public void testPartFail() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection()); - Command select = das.getCommand("testPartFail"); - try{ - select.executeQuery(); - fail("Expected exception"); - }catch(RuntimeException e){ - if(e.getMessage(). - indexOf("in query does not include Primary Key "+ - "column or has null value in it, can not proceed!") >0){ - assertTrue(true);//expected failure - } - } - } - - public void testMultiSchemaPKMiss() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig14.xml"), getConnection()); - - //Explicit compound key relationship between DASTEST1.ORDERDETAILS and DASTEST3.ORDERDETAILSDESC - //ORDERID <-> ORDERID, PRODUCTID<->PRODUCTID - // Read some order details and related order details descs - Command select = das - .createCommand("SELECT DASTEST1.ORDERDETAILS.ORDERID, DASTEST1.ORDERDETAILS.PRODUCTID," + - "DASTEST3.ORDERDETAILSDESC.ORDERID FROM DASTEST1.ORDERDETAILS LEFT JOIN DASTEST3.ORDERDETAILSDESC " + - " ON DASTEST1.ORDERDETAILS.ORDERID = DASTEST3.ORDERDETAILSDESC.ORDERID " + - " AND DASTEST1.ORDERDETAILS.PRODUCTID = DASTEST3.ORDERDETAILSDESC.PRODUCTID"); - - try{ - select.executeQuery(); - fail("Expected exception"); - }catch(RuntimeException e){ - if(e.getMessage(). - indexOf("in query does not include Primary Key "+ - "column or has null value in it, can not proceed!") >0){ - assertTrue(true);//expected failure - } - } - } - - public void testTypePropsDifferent() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MissingPK.xml"), getConnection()); - Command select = das.getCommand("get all books"); - try{ - select.executeQuery(); - fail("Expected exception"); - }catch(RuntimeException e){ - if(e.getMessage(). - indexOf("in query does not include Primary Key "+ - "column or has null value in it, can not proceed!") >0){ - assertTrue(true);//expected failure - } - } - } -} diff --git a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/MultiSchemaTests.java b/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/MultiSchemaTests.java deleted file mode 100644 index ee16434236..0000000000 --- a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/MultiSchemaTests.java +++ /dev/null @@ -1,715 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 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.MultiSchemaData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class MultiSchemaTests extends DasTest{ - protected void setUp() throws Exception { - super.setUp(); - new MultiSchemaData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /**If database is present connect to it and create necessary tables, procedures, data etc. - * - * Below is test database schema required. - * Schema Layout - - * Database: DASTEST - * Schema: DASTEST1 - * Tables: CUSTOMER, EMPLOYEE, CITY, ORDERDETAILS - * Schema: DASTEST2 - * Tables: CUSTOMER, ACCOUNT, CITY - * Schema: DASTEST3 - * Tables: CUSTOMER, CUSTORDER, ORDERDETAILSDESC - */ - - public void testMulitiSchemaCase1() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig1.xml"), getConnection()); - //test case 1 - CRUD when schemaName, tableName, typeName present - DASTEST1.CUSTOMER - //System.out.println("Result:test case 1 - CRUD when schemaName, tableName, typeName present:DASTEST1.CUSTOMER"); - //test select - //System.out.println("Result:test case 1 - SELECT"); - assertEquals(getCustomers(das).size(), 3); - - //test insert - basic - //System.out.println("Result:test case 1 - INSERT(execute())"); - addCustomer(das); - assertEquals(getCustomers(das).size(), 4); - - //test insert - use SDO - //System.out.println("Result:test case 1 - INSERT(applyChanges())"); - addSDOCustomer(das); - assertEquals(getCustomers(das).size(), 5); - - //test delete - basic - //System.out.println("Result:test case 1 - DELETE(execute())"); - deleteCustomer(das); - assertEquals(getCustomers(das).size(), 4); - - //test delete - SDO - //System.out.println("Result:test case 1 - DELETE(applyChanges())"); - deleteSDOCustomer(das); - assertEquals(getCustomers(das).size(), 3); - - //test update - //System.out.println("Result:test case 1 - UPDATE"); - changeFirstCustomerName(das); - assertEquals( ((DataObject)getCustomers(das).get(0)).get("LASTNAME"), "Williams"); - //System.out.println("******************************************"); - } - - public void testMultiSchemaCase2()throws Exception{ - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig2.xml"), getConnection()); - //test case 1 - CRUD when schemaName, tableName present, typeName not present - DASTEST2.ACCOUNT - //System.out.println("Result:test case 2 - CRUD when schemaName, tableName present, typeName not present:DASTEST2.ACCOUNT"); - //test select - //System.out.println("Result:test case 2 - SELECT"); - assertEquals(getAccounts(das).size(), 4); - - //test insert - basic - //System.out.println("Result:test case 2 - INSERT(execute())"); - addAccount(das); - assertEquals(getAccounts(das).size(), 5); - - //test insert - SDO - //System.out.println("Result:test case 2 - INSERT(applyChanges())"); - addSDOAccount(das); - assertEquals(getAccounts(das).size(), 6); - - //test delete - basic - //System.out.println("Result:test case 2 - DELETE(execute())"); - deleteAccount(das); - assertEquals(getAccounts(das).size(), 5); - - //test delete - SDO - //System.out.println("Result:test case 2 - DELETE(applyChanges())"); - deleteSDOAccount(das); - assertEquals(getAccounts(das).size(), 4); - - //test update - //System.out.println("Result:test case 2 - UPDATE"); - changeFirstAccountBalance(das); - assertEquals( ((DataObject)getAccounts(das).get(0)).get("BALANCE"), new Integer(45000)); - //System.out.println("******************************************"); - } - - public void testMultiSchemaCase3() throws Exception{ - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig3.xml"), getConnection()); - //test case 3 - CRUD when

is not there in config - DASTEST1.CITY - //System.out.println("Result:test case 3 - CRUD when
is not there in config:DASTEST1.CITY"); - //test select - //System.out.println("Result:test case 3 - SELECT"); - assertEquals(getCities(das).size(), 2); - - //test insert - basic - //System.out.println("Result:test case 3 - INSERT(execute())"); - addCity(das); - assertEquals(getCities(das).size(), 3); - - //test insert - SDO - //System.out.println("Result:test case 3 - INSERT(applyChanges())"); - assertEquals(addSDOCity(das),"Expected failure to insert"); - assertEquals(getCities(das).size(), 3); - - //test delete - basic - //System.out.println("Result:test case 3 - DELETE(execute())"); - deleteCity(das); - assertEquals(getCities(das).size(), 2); - - //test delete - SDO - //System.out.println("Result:test case 3 - DELETE(applyChanges())"); - assertEquals(deleteSDOCity(das), "Expected failure to delete"); - assertEquals(getCities(das).size(), 2); - - //test update - //System.out.println("Result:test case 3 - UPDATE"); - assertEquals(changeFirstCityName(das), "Expected failure to update"); - //System.out.println("******************************************"); - } - - public void testMultiSchemaCase4() throws Exception{ - //System.out.println("Result:test case 4 - with multi schema support ON, have table with no schemaName"); - try{ - //get das handle for invalid config - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaInvalidDasConfig.xml"), getConnection()); - }catch(Exception e){ - //No schemaName provided for tableName CUSTORDER when schemaNameSupport is ON - assertEquals("No schemaName provided for tableName CUSTORDER when schemaNameSupport is ON", - e.getMessage()); - } - - //System.out.println("******************************************"); - } - - public void testMultiSchemaCase5() throws Exception{ - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig5.xml"), getConnection()); - - //test case 5 - SELECT when CUSTOMER.ID is present in DASTEST1 and DASTEST2 - //and DASTEST2.CUSTOMER
not in config - //System.out.println("Result:test case 5 - SELECT when CUSTOMER.ID is present in DASTEST1 and DASTEST2 and"+ - // " DASTEST2.CUSTOMER
not in config"); - DataObject root = getCustomersFrom2SchemasWithOneSchemaNotInConfig(das); - assertEquals(root.getList("DASTEST1_CUSTOMER").size(), 3); - assertEquals(root.getList("DASTEST2.CUSTOMER").size(), 3); - //System.out.println("******************************************"); - } - - public void testMultiSchemaCase6()throws Exception{ - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig6.xml"), getConnection()); - //test case 6 - SELECT when CUSTOMER.ID is present in DASTEST1 and DB2ADMIN - and both
entries are in Config - //System.out.println("Result:test case 6 - SELECT when CUSTOMER.ID is present in DASTEST1 and DB2ADMIN, and both
in config"); - //test select - //System.out.println("Result:test case 6 - SELECT"); - DataObject root = getCustomersFrom2SchemasBothSchemaInConfig(das); - assertEquals(root.getList("DASTEST1_CUSTOMER").size(),3); - assertEquals(root.getList("DASTEST3_CUSTOMER").size(),3); - //System.out.println("******************************************"); - } - - public void testMultiSchemaCase7()throws Exception{ - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig7.xml"), getConnection()); - //test case 7 - SELECT when CITY.INDX is present in DASTEST1 and DASTEST2 and no enrty for - //any
in config - //System.out.println("Result:test case 7 - SELECT when CITY.INDX is present in DASTEST1 and DASTEST2, and no
in config"); - //test select - //System.out.println("Result:test case 7 - SELECT"); - DataObject root = getCitiesFrom2SchemasNoneInConfig(das); - assertEquals(root.getList("DASTEST1.CITY").size(), 2); - assertEquals(root.getList("DASTEST2.CITY").size(), 2); - //System.out.println("******************************************"); - } - - public void testMultiSchemaCase8()throws Exception{ - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig8.xml"), getConnection()); - - //test case 8 - SELECT using ResultDescriptor - DASTEST2.ACCOUNT - //System.out.println("Result:test case 8 - SELECT using ResultDescriptor:DASTEST2.ACCOUNT"); - assertEquals(getAccountRSDesc(das).size(), 4); - //System.out.println("******************************************"); - } - - public void testMultiSchemaCase9()throws Exception{ - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig9.xml"), getConnection()); - //test case 9, 11 - Implied relationship , PK when both tables in same schema DASTEST2.CUSTOMER, DASTEST2.ACCOUNT - //System.out.println("Result:test case 9, 11 - Implied relationship when both tables in same schema DASTEST2.CUSTOMER, DASTEST2.ACCOUNT"); - DataObject root = getSingleSchemaCustomersAccounts(das); - assertEquals(root.getList("DASTEST2.CUSTOMER").size(), 2); - assertEquals(root.getList("DASTEST2.ACCOUNT").size(), 4); - //System.out.println("******************************************"); - } - - private static Date kbday; - private static Date tbday; - private static DateFormat myformat = new SimpleDateFormat("yyyy.MM.dd"); - static { - try { - kbday = myformat.parse("1957.09.27"); - tbday = myformat.parse("1966.12.20"); - } catch (ParseException e) { - throw new RuntimeException(e); - } - } - - public void testMultiSchemaCase12()throws Exception{ - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig12.xml"), getConnection()); - //test case 12 - use converter with multi-schema ON:DASTEST1.EMPLOYEE - //System.out.println("Result:test case 12 - converter on DASTEST1.EMPLOYEE.LASTNAME"); - Command read = das.getCommand("testArbitraryConverter"); - // Read - DataObject root = read.executeQuery(); - - // Verify - assertEquals(kbday,root.getDate("DASTEST1.EMPLOYEE[1]/LASTNAME")); - - // Modify - root.setDate("DASTEST1.EMPLOYEE[1]/LASTNAME", tbday); - das.applyChanges(root); - - // Read - root = read.executeQuery(); - - // Verify - assertEquals(tbday, root.getDate("DASTEST1.EMPLOYEE[1]/LASTNAME")); - - //System.out.println("******************************************"); - } - - public void testMultiSchemaCase13()throws Exception{ - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig13.xml"), getConnection()); - - //Explicit relationship between DASTEST1.CUSTOMER and DASTEST2.ACCOUNT - //System.out.println("Result:test case13 - Explicit relationship when both tables in different schema DASTEST1.CUSTOMER, DASTEST2.ACCOUNT"); - // Read some customers and related accounts - Command select = das - .createCommand("SELECT * FROM DASTEST1.CUSTOMER LEFT JOIN DASTEST2.ACCOUNT "+ - " ON DASTEST1.CUSTOMER.ID = DASTEST2.ACCOUNT.CUSTOMER_ID"); - - DataObject root = select.executeQuery(); - - DataObject cust1 = root.getDataObject("DASTEST1_CUSTOMER[1]"); - DataObject cust2 = root.getDataObject("DASTEST1_CUSTOMER[2]"); - - // Save IDs - Integer cust1ID = (Integer) cust1.get("ID"); - Integer cust2ID = (Integer) cust2.get("ID"); - - //System.out.println("cust 1 ID :"+cust1ID); - //System.out.println("cust 2 ID :"+cust2ID); - // save account count - Integer cust1AccountCount = new Integer(cust1.getList("accounts").size()); - Integer cust2AccountCount = new Integer(cust2.getList("accounts").size()); - - // Move an account to cust1 from cust2 - DataObject account = (DataObject) cust2.getList("accounts").get(0); - cust1.getList("accounts").add(account); - - // Flush changes - das.applyChanges(root); - - // verify cust1 relationship updates - select = das - .createCommand("SELECT * FROM DASTEST1.CUSTOMER LEFT JOIN DASTEST2.ACCOUNT ON " - + "DASTEST1.CUSTOMER.ID = DASTEST2.ACCOUNT.CUSTOMER_ID where DASTEST1.CUSTOMER.ID = ?"); - select.setParameter(1, cust1ID); - - root = select.executeQuery(); - assertEquals((cust1AccountCount.intValue() + 1), root.getList("DASTEST1_CUSTOMER[1]/accounts").size()); - - // verify cust2 relationship updates - select.setParameter(1, cust2ID); - root = select.executeQuery(); - assertEquals((cust2AccountCount.intValue() - 1),root.getList("DASTEST1_CUSTOMER[1]/accounts").size()); - //System.out.println("******************************************"); - } - - //steer away from implied relationships - we dont support multi schema there!!! - public void testMultiSchemaCase14()throws Exception{ - DAS das = DAS.FACTORY.createDAS(getConfig("MultiSchemaDasConfig14.xml"), getConnection()); - - //Explicit compound key relationship between DASTEST1.ORDERDETAILS and DASTEST3.ORDERDETAILSDESC - //ORDERID <-> ORDERID, PRODUCTID<->PRODUCTID - //System.out.println("Result:test case14 - Explicit compound key relationship when both " + - // "tables in different schema DASTEST1.ORDERDETAILS, DASTEST3.ORDERDETAILSDESC"); - - // Read some order details and related order details descs - Command select = das - .createCommand("SELECT * FROM DASTEST1.ORDERDETAILS LEFT JOIN DASTEST3.ORDERDETAILSDESC " + - " ON DASTEST1.ORDERDETAILS.ORDERID = DASTEST3.ORDERDETAILSDESC.ORDERID " + - " AND DASTEST1.ORDERDETAILS.PRODUCTID = DASTEST3.ORDERDETAILSDESC.PRODUCTID"); - - DataObject root = select.executeQuery(); - - DataObject ordDet1 = root.getDataObject("DASTEST1.ORDERDETAILS[1]"); - DataObject ordDet2 = root.getDataObject("DASTEST1.ORDERDETAILS[2]"); - - // Save IDs - Integer ord1ID = (Integer) ordDet1.get("ORDERID"); - Integer prod1ID = (Integer) ordDet1.get("PRODUCTID"); - - Integer ord2ID = (Integer) ordDet2.get("ORDERID"); - Integer prod2ID = (Integer) ordDet2.get("PRODUCTID"); - - // save order count - Integer order1DetDescCount = new Integer(ordDet1.getList("orderDetailsDesc").size()); - Integer order2DetDescCount = new Integer(ordDet2.getList("orderDetailsDesc").size()); - - // Move an order detail desc to ord det1 from ord det2 - DataObject orderDetailsDesc = (DataObject) ordDet2.getList("orderDetailsDesc").get(0); - ordDet1.getList("orderDetailsDesc").add(orderDetailsDesc); - - // Flush changes - das.applyChanges(root); - - // verify ord det1 relationship updates - select = das - .createCommand("SELECT * FROM DASTEST1.ORDERDETAILS LEFT JOIN DASTEST3.ORDERDETAILSDESC " + - " ON DASTEST1.ORDERDETAILS.ORDERID = DASTEST3.ORDERDETAILSDESC.ORDERID " + - " AND DASTEST1.ORDERDETAILS.PRODUCTID = DASTEST3.ORDERDETAILSDESC.PRODUCTID " + - " where DASTEST1.ORDERDETAILS.ORDERID = ? AND DASTEST1.ORDERDETAILS.PRODUCTID = ?"); - select.setParameter(1, ord1ID); - select.setParameter(2, prod1ID); - - root = select.executeQuery(); - assertEquals((order1DetDescCount.intValue() + 1), - root.getList("DASTEST1.ORDERDETAILS[1]/orderDetailsDesc").size()); - - // verify ord det2 relationship updates - select.setParameter(1, ord2ID); - select.setParameter(2, prod2ID); - - root = select.executeQuery(); - assertEquals((order2DetDescCount.intValue() - 1), - root.getList("DASTEST1.ORDERDETAILS[1]/orderDetailsDesc").size()); - } - - /** - * Display result - * @param list - * @param numCols - number of columns in each row - */ - public static void printList(List list, int numCols){ - if(list != null) - System.out.println("list size:"+list.size()); - - for(int i=0; i to create/update/delete - * through config, with duplicate indexes - * @throws Exception - */ - public void testCUDNamedParameters() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("namedParameter.xml"), getConnection()); - // Read customer 1 - Command select = das.createCommand("Select * from CUSTOMER where ID = 1"); - DataObject root = select.executeQuery(); - assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); - - // Modify customer - DataObject customer = (DataObject) root.get("CUSTOMER[1]"); - customer.set("LASTNAME", "Pavick"); - customer.set("ADDRESS", "Pavick's Address"); - // Build apply changes command - try{ - das.applyChanges(root); - fail("Expected exception"); - }catch(RuntimeException e){ - assertTrue(e.getMessage().startsWith("Parameters with improper indexes!")); - } - - //create - root = select.executeQuery(); - DataObject newCustomer = root.createDataObject("CUSTOMER"); - newCustomer.setInt("ID", 6); - newCustomer.setString("LASTNAME", "Louise"); - newCustomer.setString("ADDRESS", "U.K."); - try{ - das.applyChanges(root); - fail("Expected exception"); - }catch(RuntimeException e){ - assertTrue(e.getMessage().startsWith("Parameters with duplicate indexes!")); - } - - //delete - root = select.executeQuery(); - DataObject toBeDeleted = root.getDataObject("CUSTOMER[1]"); - toBeDeleted.setString("LASTNAME", "Pavick"); - toBeDeleted.delete(); - das.applyChanges(root); - root = select.executeQuery(); - assertEquals(null, root.getDataObject("CUSTOMER[1]")); - - } - - /** - * Test passing List to Command through config - * @throws Exception - */ - public void testCommandNamedParameters() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("namedParameter.xml"), getConnection()); - //select - Command select = das.getCommand("getCustomer"); - select.setParameter("ID", new Integer(1)); - DataObject root = select.executeQuery(); - List customers = root.getList("CUSTOMER"); - assertEquals(1, customers.size()); - DataObject customer = (DataObject)customers.get(0); - assertEquals("Williams", customer.get("LASTNAME")); - - //insert - command in config has - Command insert = das.getCommand("createCustomer"); - //see order is not maintained, but config depicts it through index attrb - //if index is missing , auto increment logic will be followed - insert.setParameter("LASTNAME", "Louise"); - insert.setParameter("ADDRESS", "TPO"); - insert.setParameter("ID", new Integer(6)); - insert.execute(); - select.setParameter("ID", new Integer(6)); - root = select.executeQuery(); - customers = root.getList("CUSTOMER"); - assertEquals(1, customers.size()); - customer = (DataObject)customers.get(0); - assertEquals("Louise", customer.get("LASTNAME")); - - //insert - command in config has no - Command insertNoParam = das.getCommand("createCustomerNoParam"); - //if param/index is missing in cfg, auto increment logic will be followed - insertNoParam.setParameter("ID", new Integer(7)); - insertNoParam.setParameter("LASTNAME", "Louise7"); - insertNoParam.setParameter("ADDRESS", "TPO7"); - insertNoParam.execute(); - select.setParameter("ID", new Integer(7)); - root = select.executeQuery(); - customers = root.getList("CUSTOMER"); - assertEquals(1, customers.size()); - customer = (DataObject)customers.get(0); - assertEquals("Louise7", customer.get("LASTNAME")); - - //update - Command update = das.getCommand("updateCustomer"); - update.setParameter("LASTNAME", "NoLouise"); - update.setParameter("ID", new Integer(6)); - update.execute(); - select.setParameter("ID", new Integer(6)); - root = select.executeQuery(); - customers = root.getList("CUSTOMER"); - assertEquals(1, customers.size()); - customer = (DataObject)customers.get(0); - assertEquals("NoLouise", customer.get("LASTNAME")); - - //update - no param in config - Command updateNoParam = das.getCommand("updateCustomerNoParam"); - updateNoParam.setParameter("LASTNAME", "YesLouise"); - updateNoParam.setParameter("ID", new Integer(6)); - updateNoParam.execute(); - select.setParameter("ID", new Integer(6)); - root = select.executeQuery(); - customers = root.getList("CUSTOMER"); - assertEquals(1, customers.size()); - customer = (DataObject)customers.get(0); - assertEquals("YesLouise", customer.get("LASTNAME")); - - //delete - Command delete = das.getCommand("deleteCustomer"); - delete.setParameter("ID", new Integer(6)); - delete.execute(); - select.setParameter("ID", new Integer(6)); - root = select.executeQuery(); - customers = root.getList("CUSTOMER"); - assertEquals(0, customers.size()); - - //delete - cfg command with no param - Command deleteNoParam = das.getCommand("deleteCustomerNoParam"); - deleteNoParam.setParameter("ID", new Integer(7)); - deleteNoParam.execute(); - select.setParameter("ID", new Integer(7)); - root = select.executeQuery(); - customers = root.getList("CUSTOMER"); - assertEquals(0, customers.size()); - } - - /** - * Test passing List to Command through program - * @throws Exception - */ - public void testProgrammaticCommandNamedParameters() throws Exception { - ConfigHelper helper = new ConfigHelper(); - //Command insertAdhoc = das.createCommand("insert into CUSTOMER values (?, ?, ?)"); - org.apache.tuscany.das.rdb.config.Command insertAdhoc = ConfigFactory.INSTANCE.createCommand(); - insertAdhoc.setKind("insert"); - insertAdhoc.setSQL("insert into CUSTOMER values (?, ?, ?)"); - insertAdhoc.setName("insertCustomer"); - Parameter parameter1 = ConfigFactory.INSTANCE.createParameter(); - parameter1.setName("ID"); - Parameter parameter2 = ConfigFactory.INSTANCE.createParameter(); - parameter2.setName("LASTNAME"); - Parameter parameter3 = ConfigFactory.INSTANCE.createParameter(); - parameter3.setName("ADDRESS"); - insertAdhoc.getParameter().add(parameter1); - insertAdhoc.getParameter().add(parameter2); - insertAdhoc.getParameter().add(parameter3); - Config cfg = helper.getConfig(); - cfg.getCommand().add(insertAdhoc); - DAS das = DAS.FACTORY.createDAS(cfg, getConnection()); - - //setup is over, now set values in params and execute - Command insert = das.getCommand("insertCustomer"); - insert.setParameter("ID", new Integer(6)); - insert.setParameter("LASTNAME", "Anthony"); - insert.setParameter("ADDRESS", "IND"); - insert.execute(); - - Command select = das.createCommand("select * from CUSTOMER where ID = ?"); - select.setParameter("ID", new Integer(6)); - DataObject root = select.executeQuery(); - List customers = root.getList("CUSTOMER"); - assertEquals(1, customers.size()); - DataObject customer = (DataObject)customers.get(0); - assertEquals("Anthony", customer.get("LASTNAME")); - } - - /** - * Test set/getParameter(name) on Command - * @throws Exception - */ - public void testNamedParameters() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConnection()); - Command insertAdhoc = das.createCommand("insert into CUSTOMER values (?, ?, ?)"); - insertAdhoc.setParameter("ID", new Integer(6)); - insertAdhoc.setParameter("LASTNAME", "MyLastName"); - insertAdhoc.setParameter("ADDRESS", "MyLastAddress"); - assertEquals("MyLastAddress", insertAdhoc.getParameter("ADDRESS")); - insertAdhoc.execute(); - - Command select = das.createCommand("select * from CUSTOMER where ID = ?"); - select.setParameter("ID", new Integer(6)); - DataObject root = select.executeQuery(); - List customers = root.getList("CUSTOMER"); - assertEquals(1, customers.size()); - DataObject customer = (DataObject)customers.get(0); - assertEquals("MyLastName", customer.get("LASTNAME")); - - } -} diff --git a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OCCTests.java b/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OCCTests.java deleted file mode 100644 index 00a417da8d..0000000000 --- a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OCCTests.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.ConfigHelper; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.config.Config; -import org.apache.tuscany.das.rdb.config.ConfigFactory; -import org.apache.tuscany.das.rdb.exception.OptimisticConcurrencyException; -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.framework.DasTest; - -import commonj.sdo.DataObject; - -public class OCCTests extends DasTest { - protected void setUp() throws Exception { - super.setUp(); - - new BookData(getAutoConnection()).refresh(); - new CustomerData(getAutoConnection()).refresh(); - } - - public void testAutomaticOCC() throws SQLException { - 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(); - - // Explicitly update the DB to force a collision - Command update = das.createCommand("update CUSTOMER set LASTNAME = 'Smith' where ID = 1"); - update.execute(); - - DataObject customer = root.getDataObject("CUSTOMER[1]"); - - // Modify customer - customer.set("LASTNAME", "Pavick"); - - // Build apply changes command - try { - das.applyChanges(root); - fail("An OCCException should be thrown"); - } catch (OptimisticConcurrencyException ex) { - if (!ex.getMessage().equals("An update collision occurred")) { - throw ex; - } - } - - } - - public void testSimpleOCC() throws SQLException { - - 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 An update collision occurred - try { - das.applyChanges(root); - fail("An OCCException should be thrown"); - } catch (OptimisticConcurrencyException ex) { - if (!ex.getMessage().equals("An update collision occurred")) { - throw ex; - } - } - } - - public void testManagedOCC() throws SQLException { - 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 SQLException { - 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 An update collision occurred - try { - das.applyChanges(root); - fail("An OCCException should be thrown"); - } catch (OptimisticConcurrencyException ex) { - if (!ex.getMessage().equals("An update collision occurred")) { - throw ex; - } - } - } - - public void testProvidedConfig() throws SQLException { - // Create config programmatically - Config config = ConfigFactory.INSTANCE.createConfig(); - ConfigHelper helper = new ConfigHelper(config); - 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")); - } -} diff --git a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OneToOneRelationshipTests.java b/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OneToOneRelationshipTests.java deleted file mode 100644 index 2a58ca0fba..0000000000 --- a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OneToOneRelationshipTests.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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(); - - employee = root.getDataObject("COMPANY[1]/company->employee_opposite"); - - assertEquals("Joe Hotshot", employee.getString("NAME")); - - } - - public void testRestrictedOneToOneRelationship() throws Exception { - DAS das = DAS.FACTORY.createDAS(getConfig("OneToOneRestrictedConfig.xml"), getConnection()); - - Command read = das.getCommand("get named employee with company"); - read.setParameter(1, "Mary Smith"); - DataObject root = read.executeQuery(); - DataObject mary = root.getDataObject("EMPLOYEE[1]"); - DataObject company = mary.getDataObject("company"); - - DataObject bob = root.createDataObject("EMPLOYEE"); - bob.setString("NAME", "bob"); - bob.setString("SN", "E0005"); - bob.setInt("MANAGER", 0); - - bob.setDataObject("company", company); - - try { - das.applyChanges(root); - fail("Relationship modification should not be allowed."); - } catch (RuntimeException ex) { - assertEquals("Can not modify a one to one relationship that is key restricted", ex.getMessage()); - } - assertEquals("ACME Publishing", company.getString("NAME")); - - } -} diff --git a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OperationOrderingTests.java b/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OperationOrderingTests.java deleted file mode 100644 index 53cd02778b..0000000000 --- a/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OperationOrderingTests.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.Iterator; -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.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 { - - public OperationOrderingTests() { - super(); - } - - 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 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()); - } - - public void testDeletes() 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(); - - DataObject firstState = root.getDataObject("STATES[1]"); - String stateName = firstState.getString("NAME"); - - List cityNames = new ArrayList(); - DataObject[] citiesToDelete = new DataObject[firstState.getList("cities").size()]; - Iterator i = firstState.getList("cities").iterator(); - int ii=0; - //if we perform delete() in while, the 2nd city of the state is not deleted. - while (i.hasNext()) { - DataObject firstCity = (DataObject) i.next(); - cityNames.add(firstCity.getString("NAME")); - citiesToDelete[ii] = firstCity; - ii++; - } - - for(int j=0; j
- -
- - - - -
- - - - - - - diff --git a/java/das/rdb/src/test/resources/BooksConfig.xml b/java/das/rdb/src/test/resources/BooksConfig.xml deleted file mode 100644 index 2da86cbdb2..0000000000 --- a/java/das/rdb/src/test/resources/BooksConfig.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - -
- -
diff --git a/java/das/rdb/src/test/resources/BooksConfigWithAlias.xml b/java/das/rdb/src/test/resources/BooksConfigWithAlias.xml deleted file mode 100644 index 91bdccfac5..0000000000 --- a/java/das/rdb/src/test/resources/BooksConfigWithAlias.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - -
- -
diff --git a/java/das/rdb/src/test/resources/CompanyConfig.xml b/java/das/rdb/src/test/resources/CompanyConfig.xml deleted file mode 100644 index 793697c314..0000000000 --- a/java/das/rdb/src/test/resources/CompanyConfig.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - -
- - - -
- - - - - - -
diff --git a/java/das/rdb/src/test/resources/CompanyEmployeeConfig.xml b/java/das/rdb/src/test/resources/CompanyEmployeeConfig.xml deleted file mode 100644 index 0e25268afa..0000000000 --- a/java/das/rdb/src/test/resources/CompanyEmployeeConfig.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - -
- - - -
- - - -
- - - - - -
- diff --git a/java/das/rdb/src/test/resources/CustomerConfig.xml b/java/das/rdb/src/test/resources/CustomerConfig.xml deleted file mode 100644 index ed544f39dd..0000000000 --- a/java/das/rdb/src/test/resources/CustomerConfig.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - diff --git a/java/das/rdb/src/test/resources/CustomerConfigWithConverter.xml b/java/das/rdb/src/test/resources/CustomerConfigWithConverter.xml deleted file mode 100644 index b38922b53a..0000000000 --- a/java/das/rdb/src/test/resources/CustomerConfigWithConverter.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - -
- -
diff --git a/java/das/rdb/src/test/resources/CustomerConfigWithConverter2.xml b/java/das/rdb/src/test/resources/CustomerConfigWithConverter2.xml deleted file mode 100644 index bb49a414c4..0000000000 --- a/java/das/rdb/src/test/resources/CustomerConfigWithConverter2.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - -
- -
diff --git a/java/das/rdb/src/test/resources/CustomerConfigWithIDConverter.xml b/java/das/rdb/src/test/resources/CustomerConfigWithIDConverter.xml deleted file mode 100644 index 9a567b7ea8..0000000000 --- a/java/das/rdb/src/test/resources/CustomerConfigWithIDConverter.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - -
- -
diff --git a/java/das/rdb/src/test/resources/CustomersOrdersConfig.xml b/java/das/rdb/src/test/resources/CustomersOrdersConfig.xml deleted file mode 100644 index 323c8cb6ba..0000000000 --- a/java/das/rdb/src/test/resources/CustomersOrdersConfig.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - -
- - - -
- - - - - -
diff --git a/java/das/rdb/src/test/resources/CustomersOrdersConfigProps.xml b/java/das/rdb/src/test/resources/CustomersOrdersConfigProps.xml deleted file mode 100644 index 992cf3fa3e..0000000000 --- a/java/das/rdb/src/test/resources/CustomersOrdersConfigProps.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - -
- - - -
- - - - - -
diff --git a/java/das/rdb/src/test/resources/CustomersOrdersRelationship.xml b/java/das/rdb/src/test/resources/CustomersOrdersRelationship.xml deleted file mode 100644 index d91460052d..0000000000 --- a/java/das/rdb/src/test/resources/CustomersOrdersRelationship.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - -
- - - -
- - - - - -
diff --git a/java/das/rdb/src/test/resources/InvalidConfig1.xml b/java/das/rdb/src/test/resources/InvalidConfig1.xml deleted file mode 100644 index fa1e353281..0000000000 --- a/java/das/rdb/src/test/resources/InvalidConfig1.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - -
- - - - - -
\ No newline at end of file diff --git a/java/das/rdb/src/test/resources/InvalidConverter.xml b/java/das/rdb/src/test/resources/InvalidConverter.xml deleted file mode 100644 index e6c15ad11f..0000000000 --- a/java/das/rdb/src/test/resources/InvalidConverter.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - -
- - - - -
- - - - - -
- diff --git a/java/das/rdb/src/test/resources/ManagedBooksConfig.xml b/java/das/rdb/src/test/resources/ManagedBooksConfig.xml deleted file mode 100644 index c2b833d2bf..0000000000 --- a/java/das/rdb/src/test/resources/ManagedBooksConfig.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - -
- -
diff --git a/java/das/rdb/src/test/resources/MissingPK.xml b/java/das/rdb/src/test/resources/MissingPK.xml deleted file mode 100644 index a236f4b0e9..0000000000 --- a/java/das/rdb/src/test/resources/MissingPK.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - -
- - - -
- - - - - - - - -
- - - -
- - - - - -
- - - - - - - -
- -
diff --git a/java/das/rdb/src/test/resources/MissingPKREL.xml b/java/das/rdb/src/test/resources/MissingPKREL.xml deleted file mode 100644 index 0efd7bf63c..0000000000 --- a/java/das/rdb/src/test/resources/MissingPKREL.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - -
- - - -
- - - - - - - - - - - - - - - -
- - - -
- - - - - - -
diff --git a/java/das/rdb/src/test/resources/MultiSchemaDasConfig1.xml b/java/das/rdb/src/test/resources/MultiSchemaDasConfig1.xml deleted file mode 100644 index 2555a9ed64..0000000000 --- a/java/das/rdb/src/test/resources/MultiSchemaDasConfig1.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - -
- -
diff --git a/java/das/rdb/src/test/resources/MultiSchemaDasConfig12.xml b/java/das/rdb/src/test/resources/MultiSchemaDasConfig12.xml deleted file mode 100644 index 63ac8230ce..0000000000 --- a/java/das/rdb/src/test/resources/MultiSchemaDasConfig12.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - -
- -
diff --git a/java/das/rdb/src/test/resources/MultiSchemaDasConfig13.xml b/java/das/rdb/src/test/resources/MultiSchemaDasConfig13.xml deleted file mode 100644 index 6458108a63..0000000000 --- a/java/das/rdb/src/test/resources/MultiSchemaDasConfig13.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - -
- - - -
- - - - - -
diff --git a/java/das/rdb/src/test/resources/MultiSchemaDasConfig14.xml b/java/das/rdb/src/test/resources/MultiSchemaDasConfig14.xml deleted file mode 100644 index 4b37a11138..0000000000 --- a/java/das/rdb/src/test/resources/MultiSchemaDasConfig14.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - -
- - - -
- - - - - - - -
diff --git a/java/das/rdb/src/test/resources/MultiSchemaDasConfig2.xml b/java/das/rdb/src/test/resources/MultiSchemaDasConfig2.xml deleted file mode 100644 index d055735590..0000000000 --- a/java/das/rdb/src/test/resources/MultiSchemaDasConfig2.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - -
- - - -
- - - - - -
diff --git a/java/das/rdb/src/test/resources/MultiSchemaDasConfig3.xml b/java/das/rdb/src/test/resources/MultiSchemaDasConfig3.xml deleted file mode 100644 index 06727c6a79..0000000000 --- a/java/das/rdb/src/test/resources/MultiSchemaDasConfig3.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - diff --git a/java/das/rdb/src/test/resources/MultiSchemaDasConfig5.xml b/java/das/rdb/src/test/resources/MultiSchemaDasConfig5.xml deleted file mode 100644 index 6915c69576..0000000000 --- a/java/das/rdb/src/test/resources/MultiSchemaDasConfig5.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - -
- -
diff --git a/java/das/rdb/src/test/resources/MultiSchemaDasConfig6.xml b/java/das/rdb/src/test/resources/MultiSchemaDasConfig6.xml deleted file mode 100644 index fd3d177ad4..0000000000 --- a/java/das/rdb/src/test/resources/MultiSchemaDasConfig6.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - -
- - - - -
- - -
diff --git a/java/das/rdb/src/test/resources/MultiSchemaDasConfig7.xml b/java/das/rdb/src/test/resources/MultiSchemaDasConfig7.xml deleted file mode 100644 index eab57c759e..0000000000 --- a/java/das/rdb/src/test/resources/MultiSchemaDasConfig7.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - diff --git a/java/das/rdb/src/test/resources/MultiSchemaDasConfig8.xml b/java/das/rdb/src/test/resources/MultiSchemaDasConfig8.xml deleted file mode 100644 index 205010c5c6..0000000000 --- a/java/das/rdb/src/test/resources/MultiSchemaDasConfig8.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - -
- -
diff --git a/java/das/rdb/src/test/resources/MultiSchemaDasConfig9.xml b/java/das/rdb/src/test/resources/MultiSchemaDasConfig9.xml deleted file mode 100644 index 84a10531aa..0000000000 --- a/java/das/rdb/src/test/resources/MultiSchemaDasConfig9.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - -
- -
diff --git a/java/das/rdb/src/test/resources/MultiSchemaInvalidDasConfig.xml b/java/das/rdb/src/test/resources/MultiSchemaInvalidDasConfig.xml deleted file mode 100644 index 4658493dbd..0000000000 --- a/java/das/rdb/src/test/resources/MultiSchemaInvalidDasConfig.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - -
- - - -
- - - -
- - - -
- - - -
- - - -
diff --git a/java/das/rdb/src/test/resources/OneToOneNonRestrictedConfig.xml b/java/das/rdb/src/test/resources/OneToOneNonRestrictedConfig.xml deleted file mode 100644 index a1266f43de..0000000000 --- a/java/das/rdb/src/test/resources/OneToOneNonRestrictedConfig.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - -
- - - -
- - - - - - - - - -
- - - -
- - - - - -
\ No newline at end of file diff --git a/java/das/rdb/src/test/resources/OneToOneRestrictedConfig.xml b/java/das/rdb/src/test/resources/OneToOneRestrictedConfig.xml deleted file mode 100644 index c9ef484513..0000000000 --- a/java/das/rdb/src/test/resources/OneToOneRestrictedConfig.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - -
- - - -
- - - -
- - - - - - - - - -
- - - -
- - - - - -
- diff --git a/java/das/rdb/src/test/resources/OrderDetailsAndDescription.xml b/java/das/rdb/src/test/resources/OrderDetailsAndDescription.xml deleted file mode 100644 index d5bc8d44a8..0000000000 --- a/java/das/rdb/src/test/resources/OrderDetailsAndDescription.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - -
- - - -
- - - - - -
diff --git a/java/das/rdb/src/test/resources/OrdersOrderDetailsConfig.xml b/java/das/rdb/src/test/resources/OrdersOrderDetailsConfig.xml deleted file mode 100644 index 2e998ee57e..0000000000 --- a/java/das/rdb/src/test/resources/OrdersOrderDetailsConfig.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - -
- - - -
- - - - - -
diff --git a/java/das/rdb/src/test/resources/PartsConfig.xml b/java/das/rdb/src/test/resources/PartsConfig.xml deleted file mode 100644 index b1809079d6..0000000000 --- a/java/das/rdb/src/test/resources/PartsConfig.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
diff --git a/java/das/rdb/src/test/resources/SINGER.xsd b/java/das/rdb/src/test/resources/SINGER.xsd deleted file mode 100644 index c843929efb..0000000000 --- a/java/das/rdb/src/test/resources/SINGER.xsd +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/das/rdb/src/test/resources/asciifile.txt b/java/das/rdb/src/test/resources/asciifile.txt deleted file mode 100644 index d3c922ab52..0000000000 --- a/java/das/rdb/src/test/resources/asciifile.txt +++ /dev/null @@ -1 +0,0 @@ -this is a long file \ No newline at end of file diff --git a/java/das/rdb/src/test/resources/basicCompanyDepartmentMapping.xml b/java/das/rdb/src/test/resources/basicCompanyDepartmentMapping.xml deleted file mode 100644 index bd648cd2ef..0000000000 --- a/java/das/rdb/src/test/resources/basicCompanyDepartmentMapping.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - -
- - - - - - - -
- - - - - -
diff --git a/java/das/rdb/src/test/resources/basicCompanyMapping.xml b/java/das/rdb/src/test/resources/basicCompanyMapping.xml deleted file mode 100644 index b6ca4f9feb..0000000000 --- a/java/das/rdb/src/test/resources/basicCompanyMapping.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - -
-
diff --git a/java/das/rdb/src/test/resources/basicCustomerMapping.xml b/java/das/rdb/src/test/resources/basicCustomerMapping.xml deleted file mode 100644 index a81ca90f8e..0000000000 --- a/java/das/rdb/src/test/resources/basicCustomerMapping.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - -
- -
diff --git a/java/das/rdb/src/test/resources/basicCustomerMappingWithCUD.xml b/java/das/rdb/src/test/resources/basicCustomerMappingWithCUD.xml deleted file mode 100644 index f27a50f4f3..0000000000 --- a/java/das/rdb/src/test/resources/basicCustomerMappingWithCUD.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - -
- -
diff --git a/java/das/rdb/src/test/resources/basicCustomerMappingWithCUD2.xml b/java/das/rdb/src/test/resources/basicCustomerMappingWithCUD2.xml deleted file mode 100644 index faddf3835b..0000000000 --- a/java/das/rdb/src/test/resources/basicCustomerMappingWithCUD2.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
diff --git a/java/das/rdb/src/test/resources/basicCustomerMappingWithInvalidCUD.xml b/java/das/rdb/src/test/resources/basicCustomerMappingWithInvalidCUD.xml deleted file mode 100644 index 347cd53f45..0000000000 --- a/java/das/rdb/src/test/resources/basicCustomerMappingWithInvalidCUD.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
diff --git a/java/das/rdb/src/test/resources/basicCustomerOrderMapping.xml b/java/das/rdb/src/test/resources/basicCustomerOrderMapping.xml deleted file mode 100644 index c03d9392ed..0000000000 --- a/java/das/rdb/src/test/resources/basicCustomerOrderMapping.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - -
- - - -
- - - - - -
- diff --git a/java/das/rdb/src/test/resources/basicStaticCustomer.xml b/java/das/rdb/src/test/resources/basicStaticCustomer.xml deleted file mode 100644 index c4b4fe56af..0000000000 --- a/java/das/rdb/src/test/resources/basicStaticCustomer.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - -
- -
diff --git a/java/das/rdb/src/test/resources/cityStates.xml b/java/das/rdb/src/test/resources/cityStates.xml deleted file mode 100644 index 1908ba4268..0000000000 --- a/java/das/rdb/src/test/resources/cityStates.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - -
- - - - - - - -
- - - - - - -
diff --git a/java/das/rdb/src/test/resources/company.xsd b/java/das/rdb/src/test/resources/company.xsd deleted file mode 100644 index 0bf0229201..0000000000 --- a/java/das/rdb/src/test/resources/company.xsd +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/das/rdb/src/test/resources/companyMapping.xml b/java/das/rdb/src/test/resources/companyMapping.xml deleted file mode 100644 index 9388cf8264..0000000000 --- a/java/das/rdb/src/test/resources/companyMapping.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - -
- - - -
- - - -
- - - - - - - - - -
diff --git a/java/das/rdb/src/test/resources/companyMappingWithConverters.xml b/java/das/rdb/src/test/resources/companyMappingWithConverters.xml deleted file mode 100644 index d8609eab96..0000000000 --- a/java/das/rdb/src/test/resources/companyMappingWithConverters.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - -
- - - - -
- - - - -
- - - - - - - - - -
diff --git a/java/das/rdb/src/test/resources/companyMappingWithResultDescriptor.xml b/java/das/rdb/src/test/resources/companyMappingWithResultDescriptor.xml deleted file mode 100644 index 419f27eca3..0000000000 --- a/java/das/rdb/src/test/resources/companyMappingWithResultDescriptor.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - -
- - - - - - - - - -
diff --git a/java/das/rdb/src/test/resources/companynoid.xsd b/java/das/rdb/src/test/resources/companynoid.xsd deleted file mode 100644 index 7c301ff16a..0000000000 --- a/java/das/rdb/src/test/resources/companynoid.xsd +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/das/rdb/src/test/resources/companynoidMappingWithConverters.xml b/java/das/rdb/src/test/resources/companynoidMappingWithConverters.xml deleted file mode 100644 index bfbefddd2f..0000000000 --- a/java/das/rdb/src/test/resources/companynoidMappingWithConverters.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - -
- - - - -
- - - - -
- - - - - - - - - -
diff --git a/java/das/rdb/src/test/resources/connectionInfoDriverManagerAuth.xml b/java/das/rdb/src/test/resources/connectionInfoDriverManagerAuth.xml deleted file mode 100644 index 8a6a1880af..0000000000 --- a/java/das/rdb/src/test/resources/connectionInfoDriverManagerAuth.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - diff --git a/java/das/rdb/src/test/resources/connectionInfoDriverManagerNoAuth.xml b/java/das/rdb/src/test/resources/connectionInfoDriverManagerNoAuth.xml deleted file mode 100644 index 1c7a79acc7..0000000000 --- a/java/das/rdb/src/test/resources/connectionInfoDriverManagerNoAuth.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - diff --git a/java/das/rdb/src/test/resources/customer.xsd b/java/das/rdb/src/test/resources/customer.xsd deleted file mode 100644 index e5482ae3a0..0000000000 --- a/java/das/rdb/src/test/resources/customer.xsd +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/das/rdb/src/test/resources/customerMapping.xml b/java/das/rdb/src/test/resources/customerMapping.xml deleted file mode 100644 index 3de367e0c6..0000000000 --- a/java/das/rdb/src/test/resources/customerMapping.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - -
- -
diff --git a/java/das/rdb/src/test/resources/customerMappingWithResultDescriptor.xml b/java/das/rdb/src/test/resources/customerMappingWithResultDescriptor.xml deleted file mode 100644 index 587c437423..0000000000 --- a/java/das/rdb/src/test/resources/customerMappingWithResultDescriptor.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - -
- -
diff --git a/java/das/rdb/src/test/resources/customerOrderRelationshipMapping.xml b/java/das/rdb/src/test/resources/customerOrderRelationshipMapping.xml deleted file mode 100644 index fe8d1c5ece..0000000000 --- a/java/das/rdb/src/test/resources/customerOrderRelationshipMapping.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - -
- - -
- - - - - -
- diff --git a/java/das/rdb/src/test/resources/moin-www.png b/java/das/rdb/src/test/resources/moin-www.png deleted file mode 100644 index 253471485a..0000000000 Binary files a/java/das/rdb/src/test/resources/moin-www.png and /dev/null differ diff --git a/java/das/rdb/src/test/resources/namedParameter.xml b/java/das/rdb/src/test/resources/namedParameter.xml deleted file mode 100644 index d0b0811e33..0000000000 --- a/java/das/rdb/src/test/resources/namedParameter.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/java/das/rdb/src/test/resources/passiveConnection.xml b/java/das/rdb/src/test/resources/passiveConnection.xml deleted file mode 100644 index 6a23200d49..0000000000 --- a/java/das/rdb/src/test/resources/passiveConnection.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - diff --git a/java/das/rdb/src/test/resources/staticCustomer.xml b/java/das/rdb/src/test/resources/staticCustomer.xml deleted file mode 100644 index 705e4b34a9..0000000000 --- a/java/das/rdb/src/test/resources/staticCustomer.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - diff --git a/java/das/rdb/src/test/resources/staticCustomerOrder.xml b/java/das/rdb/src/test/resources/staticCustomerOrder.xml deleted file mode 100644 index afbe2a8cfb..0000000000 --- a/java/das/rdb/src/test/resources/staticCustomerOrder.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - -
- - - -
- - - - - -
diff --git a/java/das/rdb/src/test/resources/staticInvalid.xml b/java/das/rdb/src/test/resources/staticInvalid.xml deleted file mode 100644 index 965c99717f..0000000000 --- a/java/das/rdb/src/test/resources/staticInvalid.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - diff --git a/java/das/rdb/src/test/resources/storedProcTest.xml b/java/das/rdb/src/test/resources/storedProcTest.xml deleted file mode 100644 index beb1ca34ac..0000000000 --- a/java/das/rdb/src/test/resources/storedProcTest.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - diff --git a/java/das/samples/Readme.htm b/java/das/samples/Readme.htm deleted file mode 100644 index ff4fed6d89..0000000000 --- a/java/das/samples/Readme.htm +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - -DAS Samples - - - - - -

-
DAS Samples
-

- -
- -

The DAS Java Samples demonstrates the DAS features and how to get -started with them. Below a list of available samples:

- -
- -

    - - - - - - - - - - - - - - - - - -
    - Company-webapp - - This stand-alone sample demonstrates DAS in the context of a simple web application. -
    - Customer - - This stand-alone sample demonstrates DAS in the context of a simple java application -
    - Advanced-webapp - - This web sample demonstrates DAS advanced features in the context of a simple web application using Ajax. Some of the features demonstrated are : Basic CRUD, Optimistic Concurrency Control (OCC), Result Set Shape, Column Converter, Integration with dbConfig -
    - Transaction - - This stand-alone sample uses DAS with Geronimo Transaction Manager. Connection is passed to DAS by client. Geronimo TM manages database changes involving multiple DataGraphs under one transaction. -
    - -
- - -

- diff --git a/java/das/samples/advanced-webapp/build.xml b/java/das/samples/advanced-webapp/build.xml deleted file mode 100644 index e8d9d5fbdf..0000000000 --- a/java/das/samples/advanced-webapp/build.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/das/samples/advanced-webapp/pom.xml b/java/das/samples/advanced-webapp/pom.xml deleted file mode 100644 index 84c6bcac75..0000000000 --- a/java/das/samples/advanced-webapp/pom.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - org.apache.tuscany.das.samples - tuscany-das-samples - 1.0-SNAPSHOT - - - 4.0.0 - tuscany-das-sample-advanced-webapp - war - Tuscany DAS Advanced Sample - Advanced DAS web applicaiton Sample based on Ajax - - - - - org.apache.tuscany.das - tuscany-das-rdb - ${das.version} - compile - - - - org.apache.tuscany.sdo - tuscany-sdo-impl - ${sdo.version} - compile - - - - org.apache.tuscany.sdo - tuscany-sdo-api-r2.1 - ${sdo.version} - compile - - - - org.apache.tuscany.das.samples - tuscany-das-sample-dbconfig - ${das.version} - compile - - - org.apache.derby - derby - - - - - - javax.servlet - jstl - 1.1.2 - runtime - - - - taglibs - standard - 1.1.1 - - - - tomcat - servlet-api - 5.0.18 - provided - - - - tomcat - jsp-api - 5.0.18 - provided - - - - - - sample-advanced-webapp - src/main/java - - - src/main/java - - - src/main/resources - - - - diff --git a/java/das/samples/advanced-webapp/readme.htm b/java/das/samples/advanced-webapp/readme.htm deleted file mode 100644 index 1ddba99e5e..0000000000 --- a/java/das/samples/advanced-webapp/readme.htm +++ /dev/null @@ -1,204 +0,0 @@ - - - - - -Tuscany DAS Sample - Advanced webapp - - - - - - -

Advanced DAS web application Sample

- -
- -

-This web sample demonstrates DAS advanced features in the context of a simple web application using Ajax.
-The application user can navigate the menu to see examples of different DAS features.
-The application uses "dbConfig" utility to create canned Derby database with required tables and populate initial data in them. For refreshing database data to initial state, user can click on Refresh Button.
-

- -
    -
  • Adhoc Query (CRUD operations on COMPANY and DEPARTMENT using adhoc Sql statements)
  • -
  • DAS Command (CRUD operations on COMPANY and DEPARTMENT using DAS config commands)
  • -
  • Advanced features: -
      -
    • Optimistic Concurrency Control (Using BOOK. NAME)
    • -
    • Converter(Using CUSTOMER.LASTNAME)
    • -
    • Result Set Shape(Using CUSTOMER table)
    • -
    -
  • -
- -

-In future more features will get added. -

- - -

Running the sample

- -

-There are two options for running this sample: - -

    -
  • Run from Tomcat configured by the build
  • -
  • Deploying the sample-advanced-webapp WAR into a Tomcat you configure yourself
  • -
- -

Running from Tomcat configured by the build

- -

-You need to download the Tuscany RDB DAS source distribution and run maven build to use this option. When you build using maven from the source root {SRC_ROOT} directory, the sample war file is created under {SRC_ROOT}/samples/sample-ajax-das/target. This sample application is deployed to an instance of Tomcat as part of our automated sample testing. For this, follow instructions from reademe.htm from {SRC_ROOT}/samples/testing/tomcat. This will in-effect run the htmlunit tests on the sample. The sample deployed on Tomcat instance will be ready this way and you can just point your browser to http://localhost:8080/sample-advanced-webapp/ to test further. -

- -

Deploying the sample-ajax-das WAR into a Tomcat you configure yourself

- -

-Alternatively, you can deploy the sample to your own configured Tomcat installation by following the instructions below.
-These instructions assume that you have either : -

    -
  • 1) Downloaded the Tuscany binary distribution or
  • -
  • 2) Downloaded the Tuscany source and run maven build
  • -
-see the following link to more details steps on how to build DAS Sample applications http://incubator.apache.org/tuscany/das-java-developer-guide.html . -

- -

Set Up - Derby

- -
    -
  • Download and install the most recent stable version of Tomcat 5.5 or Tomcat 6. You can find it here: http://tomcat.apache.org/download-60.cgi
  • -
  • Download the most recent official release of Derby from here: http://db.apache.org/derby/index.html. The only file you'll need from this download is derby(version).jar
  • -
  • Stop Tomcat
  • -
  • Copy derby(version).jar (from the derby distribution) to {Tomcat_Home}/common/lib (for Tomcat 5.5) or to {Tomcat_Home}/lib (for Tomcat 6) - e.g. derby-10.2.2.0.jar.
  • -
  • Add the sample war file to {Tomcat_Home}/webapps -
      -
    • sample-advanced-webapp.war
    • -
    -
  • -
  • Define a DataSource by adding a datasource definition to {Tomcat_Home}/conf/server.xml. -
      -
    • Find the end-of-section marker and add the following lines just above it:
    • -
    - -
    -        <!-- Global Datasource for Derby ajaxdastest database -->
    -        <Resource name="jdbc/ajaxdastest"
    -                  type="javax.sql.DataSource" auth="Container"
    -                  description="Derby database for DAS Advanced sample"
    -                  maxActive="100" maxIdle="30" maxWait="10000"
    -                  username="" password=""
    -                  driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
    -                  url="jdbc:derby:{absolute path}Databases/ajaxdastest;create=true"/>
    -        
    - - Requirement: You must include the absolute path to the Databases directory in the above url attribute.
    - Fore example: url="jdbc:derby:c:\apache-tomcat-6.0.13\Databases/ajaxdastest;create=true " -

    -

  • -
  • Start tomcat and point your browser to: http://localhost:8080/sample-advanced-webapp/
  • -
- -

Set Up - MySQL

- -
    -
  • Download and install the most recent stable version of Tomcat 5.5 or Tomcat 6. You can find it here: http://tomcat.apache.org/download-60.cgi
  • -
  • Download the most recent official release of MySQL. The only file you'll need from this download is mysql(version).jar (e.g. mysql-connector-java-5.0.4.jar)
  • -
  • Stop Tomcat
  • -
  • Copy mysql(version).jar (from the MySQL distribution) to {Tomcat_Home}/common/lib (for Tomcat 5.5) or to {Tomcat_Home}/lib (for Tomcat 6) - e.g. mysql-connector-java-5.0.4.jar.
  • -
  • Add the sample war file to {Tomcat_Home}/webapps -
      -
    • sample-advanced-webapp.war
    • -
    -
  • -
  • Define a DataSource by adding a datasource definition to {Tomcat_Home}/conf/server.xml. -
      -
    • Find the end-of-section marker and add the following lines just above it:
    • -
    - -
    -        <!-- Global Datasource for MySQL ajaxdastest database -->
    -        <Resource name="jdbc/ajaxdastest"
    -                  type="javax.sql.DataSource" auth="Container"
    -                  description="MySQL database for DAS Advanced sample"
    -                  maxActive="100" maxIdle="30" maxWait="10000"
    -                  username="dastest" password="dastest"
    -                  driverClassName="com.mysql.jdbc.Driver"
    -                  url="jdbc:mysql://localhost/ajaxdastest?createDatabaseIfNotExist=true"/>
    -        
    - - Requirement: MySQL service should be up with configured port open for TCPIP communication. -
    -
    - As the new utility, dbConfig is embedded in this sample war, the MySQL database "dastest" will get created with - required tables and data when the web application gets loaded for the first time in tomcat. Please note that, - in the binary distribution, WEB-INF/classes/CompanyWebDBConfig.xml has SQL Table creation syntax for Derby. - To make it compatible to MySQL, simply replace GENERATED ALWAYS AS IDENTITY with AUTO_INCREMENT for all - table creation statements. (For this unjar the .war, change CompanyWebDBConfig.xml and jar the .war - back with changed CompanyWebDBConfig.xml) -
    -
    -
  • -
  • Start tomcat and point your browser to: http://localhost:8080/sample-advanced-webapp/
  • -
- - -

Sample Architecture

- -

The design is modular and reusable by other web samples. There are java servlet, other java classes, jsp, javascript, xml, xsl, css and html files.

- -

Client Side Files

- -

Javascripts

- -

- -
    -
  • Ajax.js:
    - Ajax.js and dasmenu.js are generic (not DAS specific) and reusable by any web sample.
  • -
  • Dasmenu.js:
    - Set response handler when request is passed to servlet. Response handler's job is transform xml response using xsl into html or plain text based on the example�s requirement.
  • -
- -

Used for menu/submenu rendering, is quite generic and can be used to display any menu.

- -

HTMLs & jsps (DAS specific files)

- -
    -
  • DASMenu.html and DASWebSampleFrame.html are for giving frame and menu to web sample. DASMenu.html calls required .jsps like indexAdhoc.jsp, indexCommand.jsp, occ.jsp, converter.jsp. These jsps are all DAS specific. The .jsp file is responsible for deciding the DAS config file required by current sample and relevant .xsl file.
  • -
- - -

Serverside files

- -
    -
  • CommandServlet.java and ServiceProcessor.java
    - Used for invoking required service and returning results back to ajax.js. These files are not DAS specific.
  • - -
  • DASQueryProcessor.java
    - Specific to DAS sample, has logic to invoke required sample example.
  • -
\ No newline at end of file diff --git a/java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/DASQueryProcessor.java b/java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/DASQueryProcessor.java deleted file mode 100644 index 86b83be235..0000000000 --- a/java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/DASQueryProcessor.java +++ /dev/null @@ -1,464 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.samples.das; - -import java.io.InputStream; -import java.lang.reflect.Method; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Iterator; -import java.util.List; -import java.util.Properties; -import java.util.Random; -import java.util.StringTokenizer; -import java.util.Vector; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.exception.OptimisticConcurrencyException; -import org.apache.tuscany.samples.web.ServiceProcessor; - -import commonj.sdo.DataObject; -import commonj.sdo.helper.XMLHelper; - -public class DASQueryProcessor extends ServiceProcessor{ - private DAS das = null; - private Command read = null; - private Random generator = new Random(); - private String configFile = null; - - private static DateFormat myformat = new SimpleDateFormat("yyyy.MM.dd"); - private static Date kbday; - private static Date tbday; - - public String execute(String queryOrcommand, String configFile) throws Exception{ - String status = null; - this.configFile = configFile; - - try{ - Properties props = validate(queryOrcommand); - - if(props != null){ - status = this.getResult((String)props.values().iterator().next(), - (String)props.keys().nextElement()); - } - - if(queryOrcommand.startsWith("occ:")){ - status = this.getOcc(); - } - - if(queryOrcommand.startsWith("converter:")){ - status = this.getConverter(queryOrcommand.substring(10)); - } - - if(queryOrcommand.startsWith("rss:")){ - status = this.getRss(queryOrcommand.substring(4)); - } - }catch(Exception e){ - das.releaseResources(); - e.printStackTrace(); - throw e; - } - das.releaseResources(); - return status ; - } - - private Properties validate(String queryOrcommand) throws Exception{ - if(queryOrcommand == null){ - throw new Exception("Invalid Command URL -> COMMAND is NULL"); - } - - if(queryOrcommand.startsWith("query:")){ - String qry = queryOrcommand.substring(6); - if(qry == null || qry.trim().length() == 0){ - throw new Exception("Invalid Command URL -> COMMAND is NULL"); - } - else{ - Properties props = new Properties(); - props.put("query", qry); - return props; - } - } - - if(queryOrcommand.startsWith("command:")){ - String cmd = queryOrcommand.substring(8); - if(cmd == null || cmd.trim().length() == 0){ - throw new Exception("Invalid Command URL -> COMMAND is NULL"); - } - else{ - Properties props = new Properties(); - props.put("command", cmd); - return props; - } - } - - - return null; - } - - /*For any query starting with query: or command: */ - private String getResult(String qry, String qryOrCommand) throws Exception { - getDAS(); - DataObject root = runCommand(qry, qryOrCommand); - //BOOK, COMPANY, DEPARTMENT, CUSTOMER - Vector elemNames = new Vector(); - if(root.getList("BOOK") != null && root.getList("BOOK").size() >0){ - elemNames.add("BOOK"); - } - if(root.getList("COMPANY") != null && root.getList("COMPANY").size() >0){ - elemNames.add("COMPANY"); - } - if(root.getList("DEPARTMENT") != null && root.getList("DEPARTMENT").size() >0){ - elemNames.add("DEPARTMENT"); - } - if(root.getList("CUSTOMER") != null && root.getList("CUSTOMER").size() >0){ - elemNames.add("CUSTOMER"); - } - - return formatResult(root, elemNames); - - } - - /* Get DAS config */ - private InputStream getConfig(String fileName) { - return getClass().getClassLoader().getResourceAsStream(fileName); - } - - /* Instantiate DAS*/ - private void getDAS(){ - das = DAS.FACTORY.createDAS(getConfig(configFile)); - } - - /*For any query starting with query: or command: */ - private DataObject runCommand(String qry, String qryOrCommand)throws Exception{ - DataObject root = null; - - //adhoc queries - if(qryOrCommand.startsWith("query")){//query can come single or batch, when batch, it will be {}{} - if(!qry.startsWith("{")){ - read = das.createCommand(qry); - root = read.executeQuery(); - } - else{ - Vector batch = formQueries(qry);//separate {}{} in different queries - - if(batch != null){ - for(int i=0; i"; - int idx = xmlStr.indexOf("\n"; - String add1Str = "\n"; - String add2Str = ""; - String addEndStr = " "; - - xmlStr = add0Str+add1Str+add2Str+xmlStr+"\n"+addEndStr; - return xmlStr; - } - - //below has improper serialization due to SDO bugs - /*From DataGraph get contents related to element */ - /*private String xmlizeContent(DataGraph graph) throws Exception{ - ByteArrayOutputStream out = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(out); - oos.writeObject(graph); - oos.flush(); - out.flush(); - //oos.close(); - out.close(); - - //there are UTF-8 chars which are not ISO-8859-1 ones and xsl transformation does not happen due to that - //so filter unwanted. - byte[] graphBytes = out.toByteArray(); - InputStreamReader graphBytesFilter = new InputStreamReader(new ByteArrayInputStream(graphBytes),"ISO-8859-1"); - char[] graphChars = new char[graphBytes.length]; - int curChar = -1; - int j=0; - while((curChar = graphBytesFilter.read()) != -1){ - graphChars[j] = (char)curChar; - j++; - } - - String finalStr = new String(graphChars); - - //remove any junk before first < - finalStr = finalStr.substring(finalStr.indexOf("<"), finalStr.indexOf("")+16); - String xmlSerializationContent = filterJunk(finalStr);//further remove extra characters appearing - System.out.println("xmlSerializationContent:"+xmlSerializationContent); - String xmlContent = XmlUtil.getXmlContents(xmlSerializationContent, "", ""); - System.out.println("xmlContent:"+xmlContent); - return xmlContent; - } - - //for some reason control chars are appearing, need to filter those - //this is ugly solution, need to know why from SDO DataGraph these - //chars are coming in the first place. - private String filterJunk(String inStr){ - char[] myCharArr = inStr.toCharArray(); - StringBuffer strBuf = new StringBuffer(); - - for(int i=0; i=33 && myCharArr[i]<=125) || - Character.isWhitespace(myCharArr[i])){ - strBuf.append(myCharArr[i]); - } - } - return strBuf.toString(); - }*/ - - /* Start CRUD example */ - public DataObject getAllCompanies(String qry) { - read = das.getCommand(qry); - DataObject root = read.executeQuery(); - return root; - } - - public DataObject getAllCompaniesAndDepartments(String qry) { - read = das.getCommand(qry); - DataObject root = read.executeQuery(); - return root; - } - - public DataObject getAddDepartmentToFirstCompany(String qry) { - Command read = das.getCommand("AllCompaniesAndDepartments"); - DataObject root = read.executeQuery(); - DataObject firstCompany = root.getDataObject("COMPANY[1]"); - - DataObject newDepartment = root.createDataObject("DEPARTMENT"); - newDepartment.setString("NAME", "Default Name"); - List deptList = firstCompany.getList("departments"); - - deptList.add(newDepartment); - das.applyChanges(root); - - root = read.executeQuery(); - return root; - } - - public DataObject getDeleteDepartmentFromFirstCompany(String qry) { - Command read = das.getCommand("AllCompaniesAndDepartments"); - DataObject root = read.executeQuery(); - DataObject firstCompany = root.getDataObject("COMPANY[1]"); - - List departments = firstCompany.getList("departments"); - DataObject departmentToDelete = (DataObject)departments.get(departments.size()-1); - departmentToDelete.delete(); - das.applyChanges(root); - root = read.executeQuery(); - return root; - } - - public DataObject getUpdateCompanyDepartmentNames(String qry) { - Command read = das.getCommand("AllCompaniesAndDepartments"); - DataObject root = read.executeQuery(); - DataObject firstCompany = root.getDataObject("COMPANY[1]"); - - Iterator i = firstCompany.getList("departments").iterator(); - - DataObject department; - while (i.hasNext()) { - department = (DataObject) i.next(); - String newName = getRandomDepartmentName(); - department.setString("NAME", newName); - break; - } - das.applyChanges(root); - - root = read.executeQuery(); - return root; - } - - /* @return random new department name */ - private String getRandomDepartmentName() { - int number = generator.nextInt(1000) + 1; - return "Dept-" + number; - } - /*End CRUD example */ - - /*Start OCC example */ - public String getOcc() throws Exception{ - getDAS(); - Command select = das.createCommand("Select * from BOOK where BOOK_ID = 1"); - DataObject root = select.executeQuery(); - // Explicitly update the DB to force a collision - Command update = das.createCommand("update BOOK set NAME = 'Puss in Hat' where BOOK_ID = 1"); - update.execute(); - DataObject book = root.getDataObject("BOOK[1]"); - - // Modify customer - book.set("NAME", "Puss in Bat"); - - // Build apply changes command - try { - das.applyChanges(root); - } catch (OptimisticConcurrencyException ex) { - if (!ex.getMessage().equals("An update collision occurred")) { - throw ex; - } - else{ - return ex.getMessage(); - } - } - return "Success"; - } - /* End OCC example */ - - /* Start Result Set Shape example*/ - public String getRss(String stmt) throws Exception{ - getDAS(); - read = das.getCommand(stmt); - //Read - DataObject root = read.executeQuery(); - Vector elemNames = new Vector(); - elemNames.add("CUSTOMER"); - return formatResult(root, elemNames); - } - /* End Result Set Shape example*/ - - /*Converter example start*/ - static { - try { - kbday = myformat.parse("1957.09.27"); - tbday = myformat.parse("1966.12.20"); - } catch (ParseException e) { - throw new RuntimeException(e); - } - } - - public String getConverter(String stmt) throws Exception{ - getDAS(); - read = das.getCommand("testArbitraryConverter"); - //Read - DataObject root = read.executeQuery(); - - if(stmt.equals("stmt0")){//Select * from CUSTOMER where ID = 1; - Vector elemNames = new Vector(); - elemNames.add("CUSTOMER"); - return this.formatResult(root, elemNames); - } - - if(stmt.equals("stmt1")){//Check First Customer's LastName is 1957.09.27 - return myformat.format(root.getDate("CUSTOMER[1]/LASTNAME")); - } - - if(stmt.equals("stmt2")||stmt.equals("stmt3")){//Set First Customer's LastName to 1966.12.20 OR - //Check First Customer's LastName is 1966.12.20 - root.setDate("CUSTOMER[1]/LASTNAME", tbday); - das.applyChanges(root); - // Read - root = read.executeQuery(); - return myformat.format(root.getDate("CUSTOMER[1]/LASTNAME")); - } - - return null; - } - /* Converter example end**/ - - /*For test*/ - public static void main(String[] args){ - DASQueryProcessor qryProc = new DASQueryProcessor(); - try{ - qryProc.execute("command:AllCompaniesAndDepartments", "DasConfig.xml"); - }catch(Exception e){ - e.printStackTrace(); - } - - } - -} diff --git a/java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/SillyDateStringConverter.java b/java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/SillyDateStringConverter.java deleted file mode 100644 index f1fe21cfd4..0000000000 --- a/java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/SillyDateStringConverter.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.samples.das; - -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 { - - private static DateFormat myformat = new SimpleDateFormat("yyyy.MM.dd"); - - private static Date kbday; - - private static Date tbday; - - public SillyDateStringConverter() { - super(); - } - - 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("Pavick")) { - return kbday; - } - - if (columnData.equals("Williams")) { - return tbday; - } - - throw new IllegalArgumentException(); - - } - - public Object getColumnValue(Object propertyData) { - if (propertyData.equals(kbday)) { - return "Pavick"; - } - - if (propertyData.equals(tbday)) { - return "Williams"; - } - - throw new IllegalArgumentException(); - - } - -} diff --git a/java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/StringToLongConverter.java b/java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/StringToLongConverter.java deleted file mode 100644 index fc26164191..0000000000 --- a/java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/StringToLongConverter.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.samples.das; - -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/java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/util/XmlUtil.java b/java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/util/XmlUtil.java deleted file mode 100644 index 9a615fa33c..0000000000 --- a/java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/das/util/XmlUtil.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.samples.das.util; -/** - * - * XML utilities - * - */ -public class XmlUtil { - /** - * From the complete serialized DataGraph, get the required portion - *relevant to element. - */ - public static String getXmlContents(String xmlString, String xmlStartElement, String xmlEndElement){ - int posStartElement = xmlString.indexOf(xmlStartElement); - int posEndElement = xmlString.indexOf(xmlEndElement) ; - - //check if startElement was not found - if(posStartElement == -1) - posStartElement = 0; - - //check if endElement was not found - if(posEndElement == -1) - posEndElement = xmlString.length(); - else - //fixup the posEndElement to return the closing element tag - posEndElement += + xmlEndElement.length(); - - //return xml contents for the requested element - String xmlBody = xmlString.substring(posStartElement, posEndElement); - - - String result = - " \n"+ - " \n"+ - xmlBody+" "; - - return result; - } - -} diff --git a/java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/CommandServlet.java b/java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/CommandServlet.java deleted file mode 100644 index ffab0d107b..0000000000 --- a/java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/CommandServlet.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.samples.web; - -import java.io.IOException; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.tuscany.das.rdb.dbconfig.DBInitializer; -/** - * This is generic servlet where based on serviceName, it will call the speciliazed processor to - * process request and obtain response. This servlet can be used in any web sample, just needs to - * pass appropriate serviceProcessorClassName and rest is generic - * - */ -public class CommandServlet extends HttpServlet { - final static long serialVersionUID = 1221332432; - /* - * (non-Java-doc) - * - * @see javax.servlet.http.HttpServlet#HttpServlet() - */ - public CommandServlet() { - super(); - } - - public static void refreshDB() throws ServletException { - try{ - DBInitializer dbInitializer = new DBInitializer("AjaxDBConfig.xml"); - dbInitializer.refreshDatabaseData(); - }catch(Exception e){ - e.printStackTrace(); - ServletException se = new ServletException(e.getMessage()); - throw se; - } - } - - public void init(ServletConfig config) throws ServletException { - refreshDB(); - } - - /* - * (non-Java-doc) - * - * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest arg0, - * HttpServletResponse arg1) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - doTask(request, response); - } - - /* - * (non-Java-doc) - * - * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest arg0, - * HttpServletResponse arg1) - */ - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - doTask(request, response); - } - - /**Invoke passed service and return result - * - * @param req - * @param resp - * @throws ServletException - * @throws IOException - */ - public void doTask(HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { - String textContentType= "text/text"; - String xmlContentType= "text/xml"; - - String refreshRequest = req.getParameter("refreshDB"); - if(refreshRequest != null && refreshRequest.equals("yes")){ - { - try{ - refreshDB(); - }catch(ServletException e){ - throw e; - } - } - this.writeResponse(resp, "Refreshed database!", textContentType); - } - else{ - String serviceName = req.getParameter("serviceName");//e.g. DASQueryProcessor - String qry = req.getParameter("Query");//e.g. query:xxx, command:yyy - String configFile = req.getParameter("configFile");//name of DAS config file - - try{ - ServiceProcessor serviceClassInst = null; - //so any subclass of abstract ServiceProcessor can be used - Object obj = Class.forName(serviceName).newInstance(); - - if(obj instanceof ServiceProcessor){ - serviceClassInst = (ServiceProcessor)obj; - } - - String result = serviceClassInst.execute(qry, configFile); - this.writeResponse(resp, result, xmlContentType); - }catch(Exception e){ - this.writeResponse(resp, e.getMessage(), textContentType); - e.printStackTrace(); - } - } - } - - /**Write response in required content type to servlet response - * - * @param resp - * @param output - * @param contentType - * @throws IOException - */ - public void writeResponse(HttpServletResponse resp, String output, String contentType) throws IOException { - resp.setContentType(contentType);//"text/text", "text/xml" - resp.setHeader("Cache-Control", "no-cache"); - resp.getWriter().write(output); - } - - // Utility methods - - public void gotoURL(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String url) throws ServletException, IOException { - url = response.encodeURL(url); - RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url); - dispatcher.forward(request, response); - } - - public void redirectURL(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String url) throws ServletException, IOException { - url = response.encodeURL(request.getContextPath() + url); - response.sendRedirect(url); - } - - public void forwardURL(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String url) throws ServletException, IOException { - url = response.encodeURL(url); - RequestDispatcher dispatch = getServletContext().getRequestDispatcher(url); - dispatch.forward(request, response); - } -} diff --git a/java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/ServiceProcessor.java b/java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/ServiceProcessor.java deleted file mode 100644 index aefebb8808..0000000000 --- a/java/das/samples/advanced-webapp/src/main/java/org/apache/tuscany/samples/web/ServiceProcessor.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.samples.web; - -//generic processor -public abstract class ServiceProcessor { - public abstract String execute(String command, String configFile) throws Exception; -} diff --git a/java/das/samples/advanced-webapp/src/main/resources/AjaxDBConfig.xml b/java/das/samples/advanced-webapp/src/main/resources/AjaxDBConfig.xml deleted file mode 100644 index f172c089c9..0000000000 --- a/java/das/samples/advanced-webapp/src/main/resources/AjaxDBConfig.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - 'ACME Publishing' - 'Do-rite plumbing' - 'MegaCorp' -
- - - 'Advanced Technologies', 'NY', '123', 1 -
- - - 1, 'Pavick', 'CA' - 2, 'Williams', 'NJ' -
- - - 1, 'The Brothers Karamazov', 'Fyodor Dostoevsky',5, 17 -
- -
diff --git a/java/das/samples/advanced-webapp/src/main/resources/CustomerConfigWithConverter.xml b/java/das/samples/advanced-webapp/src/main/resources/CustomerConfigWithConverter.xml deleted file mode 100644 index 0ef0c5b9b1..0000000000 --- a/java/das/samples/advanced-webapp/src/main/resources/CustomerConfigWithConverter.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - -
- -
diff --git a/java/das/samples/advanced-webapp/src/main/resources/CustomerConfigWithIDConverter.xml b/java/das/samples/advanced-webapp/src/main/resources/CustomerConfigWithIDConverter.xml deleted file mode 100644 index f26082a340..0000000000 --- a/java/das/samples/advanced-webapp/src/main/resources/CustomerConfigWithIDConverter.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - -
- -
diff --git a/java/das/samples/advanced-webapp/src/main/resources/DasConfig.xml b/java/das/samples/advanced-webapp/src/main/resources/DasConfig.xml deleted file mode 100644 index 69ac31895c..0000000000 --- a/java/das/samples/advanced-webapp/src/main/resources/DasConfig.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - -
- - - -
- - - -
- - - - - - -
diff --git a/java/das/samples/advanced-webapp/src/main/resources/META-INF/LICENSE b/java/das/samples/advanced-webapp/src/main/resources/META-INF/LICENSE deleted file mode 100644 index fb4df3722c..0000000000 --- a/java/das/samples/advanced-webapp/src/main/resources/META-INF/LICENSE +++ /dev/null @@ -1,353 +0,0 @@ - - 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. - -=============================================================================================================== - -Other components and dependencies under Apache Software License 2.0 : - - log4j-1.2.14.jar - Apache Logging Services - derby 10.2.2.0.jar - Apache Derby - stax-api-1.0.1.jar - The Streaming API for XML (StAX) - wstx-asl-3.2.0.jar - WoodStox StAX implementation - standard-1.1.1.jar - The Apache Jackarta Taglibs - jstl-1.1.2.jar - The Apache Jackarta Taglibs - *.tld - The Apache Jackarta Taglibs - -=============================================================================================================== - - -Apache Tuscany SDO for Java Subcomponents -=========================================: - -The Tuscany SDO for Java release 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. - -License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar) - -Permission to copy, make derivative works of, and distribute the Service Data Objects -JavaDoc and Interface Definition Files files in any medium without fee or royalty as part -of a compliant implementation of the Service Data Objects Specification is hereby granted. -The Service Data Objects Specification may be found at any of the following locations: - -http://dev2dev.bea.com/technologies/commonj/index.jsp -http://www.ibm.com/developerworks/library/specification/ws-sdo/ -http://oracle.com/technology/webservices/sca -https://www.sdn.sap.com/ -http://www.xcalia/xdn/specs/sdo - -THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES -ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS -SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS, -INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, -NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE -SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES. - -The name and trademarks of the Authors may NOT be used in any manner, including advertising or -publicity pertaining to the Service Component Architecture Specification or its contents without specific, -written prior permission. Title to copyright in the Service Data Objects Specification and the -JavaDoc and Interface Definition Files will at all times remain with the Authors. - -No other rights are granted by implication, estoppel or otherwise. - -================================================================================================================= - -For the Eclipse EMF components -(codegen-2.2.3.jar -codegen-ecore-2.2.3.jar -common-2.2.3.jar -ecore-2.2.3.jar -ecore-change-2.2.3.jar -ecore-xmi-2.2.3.jar -xsd-2.2.3.jar) - -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. - -=================================================================================================== diff --git a/java/das/samples/advanced-webapp/src/main/resources/META-INF/NOTICE b/java/das/samples/advanced-webapp/src/main/resources/META-INF/NOTICE deleted file mode 100644 index c2cf1f95b4..0000000000 --- a/java/das/samples/advanced-webapp/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,32 +0,0 @@ -Apache Tuscany SDO for Java -Copyright 2006, 2007 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - -Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF), -sponsored by the Apache 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. - -Unless otherwise indicated, all distribution made available by the Apache Software Foundation -is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL"). -A copy of the AL is provided with this distribution as the LICENSE.txt file present in the -root directory, and is also available at http://www.apache.org/licenses/. - -The terms and conditions governing the distribution may refer to the AL or other license -agreements, notices or terms and conditions. Some of these other license agreements may -include (but are not limited to): - - . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html) - -It is your obligation to read and accept all such terms and conditions prior to use of the -distribution. If term or condition is provided, please contact the Apache Software Foundation -to determine what terms and conditions govern that particular distribution. - -This product also includes software developed by the Open Service Oriented Architecture organisation -(http://osoa.org). The license for this software may be found in the LICENSE.txt file contained in this -distribution. diff --git a/java/das/samples/advanced-webapp/src/main/resources/META-INF/README b/java/das/samples/advanced-webapp/src/main/resources/META-INF/README deleted file mode 100644 index d1905ee3e8..0000000000 --- a/java/das/samples/advanced-webapp/src/main/resources/META-INF/README +++ /dev/null @@ -1,35 +0,0 @@ -Apache Tuscany M2 build (October, 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/java/das/samples/advanced-webapp/src/main/resources/log4j.properties b/java/das/samples/advanced-webapp/src/main/resources/log4j.properties deleted file mode 100644 index 7f18e4dc72..0000000000 --- a/java/das/samples/advanced-webapp/src/main/resources/log4j.properties +++ /dev/null @@ -1,36 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=INFO, NULL - -# NULL Appender -log4j.appender.NULL=org.apache.log4j.varia.NullAppender - -log4j.appender.NULL.layout=org.apache.log4j.PatternLayout -log4j.appender.NULL.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n - -# CONSOLE is set to be a ConsoleAppender. -log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout -log4j.appender.CONSOLE.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n - - -# Print only messages of level WARN or above in the package com.foo. -log4j.logger.org.apache.tuscany=NONE \ No newline at end of file diff --git a/java/das/samples/advanced-webapp/src/main/webapp/META-INF/context.xml b/java/das/samples/advanced-webapp/src/main/webapp/META-INF/context.xml deleted file mode 100644 index e2da613636..0000000000 --- a/java/das/samples/advanced-webapp/src/main/webapp/META-INF/context.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - diff --git a/java/das/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/c.tld b/java/das/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/c.tld deleted file mode 100644 index 22698c97dc..0000000000 --- a/java/das/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/c.tld +++ /dev/null @@ -1,563 +0,0 @@ - - - - - JSTL 1.1 core library - JSTL core - 1.1 - c - http://java.sun.com/jsp/jstl/core - - - - Provides core validation features for JSTL tags. - - - org.apache.taglibs.standard.tlv.JstlCoreTLV - - - - - - Catches any Throwable that occurs in its body and optionally - exposes it. - - catch - org.apache.taglibs.standard.tag.common.core.CatchTag - JSP - - -Name of the exported scoped variable for the -exception thrown from a nested action. The type of the -scoped variable is the type of the exception thrown. - - var - false - false - - - - - - Simple conditional tag that establishes a context for - mutually exclusive conditional operations, marked by - <when> and <otherwise> - - choose - org.apache.taglibs.standard.tag.common.core.ChooseTag - JSP - - - - - Simple conditional tag, which evalutes its body if the - supplied condition is true and optionally exposes a Boolean - scripting variable representing the evaluation of this condition - - if - org.apache.taglibs.standard.tag.rt.core.IfTag - JSP - - -The test condition that determines whether or -not the body content should be processed. - - test - true - true - boolean - - - -Name of the exported scoped variable for the -resulting value of the test condition. The type -of the scoped variable is Boolean. - - var - false - false - - - -Scope for var. - - scope - false - false - - - - - - Retrieves an absolute or relative URL and exposes its contents - to either the page, a String in 'var', or a Reader in 'varReader'. - - import - org.apache.taglibs.standard.tag.rt.core.ImportTag - org.apache.taglibs.standard.tei.ImportTEI - JSP - - -The URL of the resource to import. - - url - true - true - - - -Name of the exported scoped variable for the -resource's content. The type of the scoped -variable is String. - - var - false - false - - - -Scope for var. - - scope - false - false - - - -Name of the exported scoped variable for the -resource's content. The type of the scoped -variable is Reader. - - varReader - false - false - - - -Name of the context when accessing a relative -URL resource that belongs to a foreign -context. - - context - false - true - - - -Character encoding of the content at the input -resource. - - charEncoding - false - true - - - - - - The basic iteration tag, accepting many different - collection types and supporting subsetting and other - functionality - - forEach - org.apache.taglibs.standard.tag.rt.core.ForEachTag - org.apache.taglibs.standard.tei.ForEachTEI - JSP - - -Collection of items to iterate over. - - items - false - true - java.lang.Object - - - -If items specified: -Iteration begins at the item located at the -specified index. First item of the collection has -index 0. -If items not specified: -Iteration begins with index set at the value -specified. - - begin - false - true - int - - - -If items specified: -Iteration ends at the item located at the -specified index (inclusive). -If items not specified: -Iteration ends when index reaches the value -specified. - - end - false - true - int - - - -Iteration will only process every step items of -the collection, starting with the first one. - - step - false - true - int - - - -Name of the exported scoped variable for the -current item of the iteration. This scoped -variable has nested visibility. Its type depends -on the object of the underlying collection. - - var - false - false - - - -Name of the exported scoped variable for the -status of the iteration. Object exported is of type -javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested -visibility. - - varStatus - false - false - - - - - - Iterates over tokens, separated by the supplied delimeters - - forTokens - org.apache.taglibs.standard.tag.rt.core.ForTokensTag - JSP - - -String of tokens to iterate over. - - items - true - true - java.lang.String - - - -The set of delimiters (the characters that -separate the tokens in the string). - - delims - true - true - java.lang.String - - - -Iteration begins at the token located at the -specified index. First token has index 0. - - begin - false - true - int - - - -Iteration ends at the token located at the -specified index (inclusive). - - end - false - true - int - - - -Iteration will only process every step tokens -of the string, starting with the first one. - - step - false - true - int - - - -Name of the exported scoped variable for the -current item of the iteration. This scoped -variable has nested visibility. - - var - false - false - - - -Name of the exported scoped variable for the -status of the iteration. Object exported is of -type -javax.servlet.jsp.jstl.core.LoopTag -Status. This scoped variable has nested -visibility. - - varStatus - false - false - - - - - - Like <%= ... >, but for expressions. - - out - org.apache.taglibs.standard.tag.rt.core.OutTag - JSP - - -Expression to be evaluated. - - value - true - true - - - -Default value if the resulting value is null. - - default - false - true - - - -Determines whether characters <,>,&,'," in the -resulting string should be converted to their -corresponding character entity codes. Default value is -true. - - escapeXml - false - true - - - - - - - Subtag of <choose> that follows <when> tags - and runs only if all of the prior conditions evaluated to - 'false' - - otherwise - org.apache.taglibs.standard.tag.common.core.OtherwiseTag - JSP - - - - - Adds a parameter to a containing 'import' tag's URL. - - param - org.apache.taglibs.standard.tag.rt.core.ParamTag - JSP - - -Name of the query string parameter. - - name - true - true - - - -Value of the parameter. - - value - false - true - - - - - - Redirects to a new URL. - - redirect - org.apache.taglibs.standard.tag.rt.core.RedirectTag - JSP - - -The URL of the resource to redirect to. - - url - false - true - - - -Name of the context when redirecting to a relative URL -resource that belongs to a foreign context. - - context - false - true - - - - - - Removes a scoped variable (from a particular scope, if specified). - - remove - org.apache.taglibs.standard.tag.common.core.RemoveTag - empty - - -Name of the scoped variable to be removed. - - var - true - false - - - -Scope for var. - - scope - false - false - - - - - - Sets the result of an expression evaluation in a 'scope' - - set - org.apache.taglibs.standard.tag.rt.core.SetTag - JSP - - -Name of the exported scoped variable to hold the value -specified in the action. The type of the scoped variable is -whatever type the value expression evaluates to. - - var - false - false - - - -Expression to be evaluated. - - value - false - true - - - -Target object whose property will be set. Must evaluate to -a JavaBeans object with setter property property, or to a -java.util.Map object. - - target - false - true - - - -Name of the property to be set in the target object. - - property - false - true - - - -Scope for var. - - scope - false - false - - - - - - Creates a URL with optional query parameters. - - url - org.apache.taglibs.standard.tag.rt.core.UrlTag - JSP - - -Name of the exported scoped variable for the -processed url. The type of the scoped variable is -String. - - var - false - false - - - -Scope for var. - - scope - false - false - - - -URL to be processed. - - value - false - true - - - -Name of the context when specifying a relative URL -resource that belongs to a foreign context. - - context - false - true - - - - - - Subtag of <choose> that includes its body if its - condition evalutes to 'true' - - when - org.apache.taglibs.standard.tag.rt.core.WhenTag - JSP - - -The test condition that determines whether or not the -body content should be processed. - - test - true - true - boolean - - - - diff --git a/java/das/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/fmt.tld b/java/das/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/fmt.tld deleted file mode 100644 index 3b9a54a87d..0000000000 --- a/java/das/samples/advanced-webapp/src/main/webapp/WEB-INF/tld/fmt.tld +++ /dev/null @@ -1,671 +0,0 @@ - - - - - JSTL 1.1 i18n-capable formatting library - JSTL fmt - 1.1 - fmt - http://java.sun.com/jsp/jstl/fmt - - - - Provides core validation features for JSTL tags. - - - org.apache.taglibs.standard.tlv.JstlFmtTLV - - - - - - Sets the request character encoding - - requestEncoding - org.apache.taglibs.standard.tag.rt.fmt.RequestEncodingTag - empty - - -Name of character encoding to be applied when -decoding request parameters. - - value - false - true - - - - - - Stores the given locale in the locale configuration variable - - setLocale - org.apache.taglibs.standard.tag.rt.fmt.SetLocaleTag - empty - - -A String value is interpreted as the -printable representation of a locale, which -must contain a two-letter (lower-case) -language code (as defined by ISO-639), -and may contain a two-letter (upper-case) -country code (as defined by ISO-3166). -Language and country codes must be -separated by hyphen (-) or underscore -(_). - - value - true - true - - - -Vendor- or browser-specific variant. -See the java.util.Locale javadocs for -more information on variants. - - variant - false - true - - - -Scope of the locale configuration variable. - - scope - false - false - - - - - - Specifies the time zone for any time formatting or parsing actions - nested in its body - - timeZone - org.apache.taglibs.standard.tag.rt.fmt.TimeZoneTag - JSP - - -The time zone. A String value is interpreted as -a time zone ID. This may be one of the time zone -IDs supported by the Java platform (such as -"America/Los_Angeles") or a custom time zone -ID (such as "GMT-8"). See -java.util.TimeZone for more information on -supported time zone formats. - - value - true - true - - - - - - Stores the given time zone in the time zone configuration variable - - setTimeZone - org.apache.taglibs.standard.tag.rt.fmt.SetTimeZoneTag - empty - - -The time zone. A String value is interpreted as -a time zone ID. This may be one of the time zone -IDs supported by the Java platform (such as -"America/Los_Angeles") or a custom time zone -ID (such as "GMT-8"). See java.util.TimeZone for -more information on supported time zone -formats. - - value - true - true - - - -Name of the exported scoped variable which -stores the time zone of type -java.util.TimeZone. - - var - false - false - - - -Scope of var or the time zone configuration -variable. - - scope - false - false - - - - - - Loads a resource bundle to be used by its tag body - - bundle - org.apache.taglibs.standard.tag.rt.fmt.BundleTag - JSP - - -Resource bundle base name. This is the bundle's -fully-qualified resource name, which has the same -form as a fully-qualified class name, that is, it uses -"." as the package component separator and does not -have any file type (such as ".class" or ".properties") -suffix. - - basename - true - true - - - -Prefix to be prepended to the value of the message -key of any nested <fmt:message> action. - - prefix - false - true - - - - - - Loads a resource bundle and stores it in the named scoped variable or - the bundle configuration variable - - setBundle - org.apache.taglibs.standard.tag.rt.fmt.SetBundleTag - empty - - -Resource bundle base name. This is the bundle's -fully-qualified resource name, which has the same -form as a fully-qualified class name, that is, it uses -"." as the package component separator and does not -have any file type (such as ".class" or ".properties") -suffix. - - basename - true - true - - - -Name of the exported scoped variable which stores -the i18n localization context of type -javax.servlet.jsp.jstl.fmt.LocalizationC -ontext. - - var - false - false - - - -Scope of var or the localization context -configuration variable. - - scope - false - false - - - - - - Maps key to localized message and performs parametric replacement - - message - org.apache.taglibs.standard.tag.rt.fmt.MessageTag - JSP - - -Message key to be looked up. - - key - false - true - - - -Localization context in whose resource -bundle the message key is looked up. - - bundle - false - true - - - -Name of the exported scoped variable -which stores the localized message. - - var - false - false - - - -Scope of var. - - scope - false - false - - - - - - Supplies an argument for parametric replacement to a containing - <message> tag - - param - org.apache.taglibs.standard.tag.rt.fmt.ParamTag - JSP - - -Argument used for parametric replacement. - - value - false - true - - - - - - Formats a numeric value as a number, currency, or percentage - - formatNumber - org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag - JSP - - -Numeric value to be formatted. - - value - false - true - - - -Specifies whether the value is to be -formatted as number, currency, or -percentage. - - type - false - true - - - -Custom formatting pattern. - - pattern - false - true - - - -ISO 4217 currency code. Applied only -when formatting currencies (i.e. if type is -equal to "currency"); ignored otherwise. - - currencyCode - false - true - - - -Currency symbol. Applied only when -formatting currencies (i.e. if type is equal -to "currency"); ignored otherwise. - - currencySymbol - false - true - - - -Specifies whether the formatted output -will contain any grouping separators. - - groupingUsed - false - true - - - -Maximum number of digits in the integer -portion of the formatted output. - - maxIntegerDigits - false - true - - - -Minimum number of digits in the integer -portion of the formatted output. - - minIntegerDigits - false - true - - - -Maximum number of digits in the -fractional portion of the formatted output. - - maxFractionDigits - false - true - - - -Minimum number of digits in the -fractional portion of the formatted output. - - minFractionDigits - false - true - - - -Name of the exported scoped variable -which stores the formatted result as a -String. - - var - false - false - - - -Scope of var. - - scope - false - false - - - - - - Parses the string representation of a number, currency, or percentage - - parseNumber - org.apache.taglibs.standard.tag.rt.fmt.ParseNumberTag - JSP - - -String to be parsed. - - value - false - true - - - -Specifies whether the string in the value -attribute should be parsed as a number, -currency, or percentage. - - type - false - true - - - -Custom formatting pattern that determines -how the string in the value attribute is to be -parsed. - - pattern - false - true - - - -Locale whose default formatting pattern (for -numbers, currencies, or percentages, -respectively) is to be used during the parse -operation, or to which the pattern specified -via the pattern attribute (if present) is -applied. - - parseLocale - false - true - - - -Specifies whether just the integer portion of -the given value should be parsed. - - integerOnly - false - true - - - -Name of the exported scoped variable which -stores the parsed result (of type -java.lang.Number). - - var - false - false - - - -Scope of var. - - scope - false - false - - - - - - Formats a date and/or time using the supplied styles and pattern - - formatDate - org.apache.taglibs.standard.tag.rt.fmt.FormatDateTag - empty - - -Date and/or time to be formatted. - - value - true - true - - - -Specifies whether the time, the date, or both -the time and date components of the given -date are to be formatted. - - type - false - true - - - -Predefined formatting style for dates. Follows -the semantics defined in class -java.text.DateFormat. Applied only -when formatting a date or both a date and -time (i.e. if type is missing or is equal to -"date" or "both"); ignored otherwise. - - dateStyle - false - true - - - -Predefined formatting style for times. Follows -the semantics defined in class -java.text.DateFormat. Applied only -when formatting a time or both a date and -time (i.e. if type is equal to "time" or "both"); -ignored otherwise. - - timeStyle - false - true - - - -Custom formatting style for dates and times. - - pattern - false - true - - - -Time zone in which to represent the formatted -time. - - timeZone - false - true - - - -Name of the exported scoped variable which -stores the formatted result as a String. - - var - false - false - - - -Scope of var. - - scope - false - false - - - - - - Parses the string representation of a date and/or time - - parseDate - org.apache.taglibs.standard.tag.rt.fmt.ParseDateTag - JSP - - -Date string to be parsed. - - value - false - true - - - -Specifies whether the date string in the -value attribute is supposed to contain a -time, a date, or both. - - type - false - true - - - -Predefined formatting style for days -which determines how the date -component of the date string is to be -parsed. Applied only when formatting a -date or both a date and time (i.e. if type -is missing or is equal to "date" or "both"); -ignored otherwise. - - dateStyle - false - true - - - -Predefined formatting styles for times -which determines how the time -component in the date string is to be -parsed. Applied only when formatting a -time or both a date and time (i.e. if type -is equal to "time" or "both"); ignored -otherwise. - - timeStyle - false - true - - - -Custom formatting pattern which -determines how the date string is to be -parsed. - - pattern - false - true - - - -Time zone in which to interpret any time -information in the date string. - - timeZone - false - true - - - -Locale whose predefined formatting styles -for dates and times are to be used during -the parse operation, or to which the -pattern specified via the pattern -attribute (if present) is applied. - - parseLocale - false - true - - - -Name of the exported scoped variable in -which the parsing result (of type -java.util.Date) is stored. - - var - false - false - - - -Scope of var. - - scope - false - false - - - - diff --git a/java/das/samples/advanced-webapp/src/main/webapp/WEB-INF/web.xml b/java/das/samples/advanced-webapp/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index c60d36566b..0000000000 --- a/java/das/samples/advanced-webapp/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - Tuscany DAS Features - - html/DASWebSampleFrame.html - - - - - CommandServlet - CommandServlet - org.apache.tuscany.samples.web.CommandServlet - - - CommandServlet - /CommandServlet - - - - - http://java.sun.com/jstl/core - /WEB-INF/tld/c.tld - - - http://java.sun.com/jstl/fmt - /WEB-INF/tld/fmt.tld - - diff --git a/java/das/samples/advanced-webapp/src/main/webapp/html/DASWebSampleFrame.html b/java/das/samples/advanced-webapp/src/main/webapp/html/DASWebSampleFrame.html deleted file mode 100644 index 49f913eaec..0000000000 --- a/java/das/samples/advanced-webapp/src/main/webapp/html/DASWebSampleFrame.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - -Tuscany DAS Web Sample - - - - - - \ No newline at end of file diff --git a/java/das/samples/advanced-webapp/src/main/webapp/html/blank.html b/java/das/samples/advanced-webapp/src/main/webapp/html/blank.html deleted file mode 100644 index 0bc2a49864..0000000000 --- a/java/das/samples/advanced-webapp/src/main/webapp/html/blank.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/java/das/samples/advanced-webapp/src/main/webapp/js/ajax.js b/java/das/samples/advanced-webapp/src/main/webapp/js/ajax.js deleted file mode 100644 index c0b0be5e54..0000000000 --- a/java/das/samples/advanced-webapp/src/main/webapp/js/ajax.js +++ /dev/null @@ -1,188 +0,0 @@ -// - -var req; -var url; -var xslFileName; -var brwsr; -var htmlunitlimit; - -function startup(pageName) { - if(pageName == 'adhoc'){ - document.forms[0].sqlQuery.focus = true; - } - - if(pageName == 'command') { - document.forms[0].DasCommand.focus = true; - } -} - -function init() { - if (window.XMLHttpRequest) { - brwsr="NOIE"; - req = new XMLHttpRequest(); - } else if (window.ActiveXObject) { - brwsr="IE"; - req = new ActiveXObject("Microsoft.XMLHTTP"); - } - var url = "../CommandServlet"; - req.open("POST", url, true); - req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); -} - -function formWaitMessage(){ - var swappableSection = document.getElementById('msg'); - if (window.XSLTProcessor) - { - swappableSection.innerHTML = ''; - var x = document.createTextNode('Retreiving result..please wait'); - swappableSection.appendChild(x); - } - else if(window.ActiveXObject) - { - swappableSection.innerHTML = 'Retreiving result..please wait' ; - } -} - -function executeQuery(reqParams, xslFileNameVal) { - init(); - req.onreadystatechange = resultHandler; - xslFileName = xslFileNameVal; - //alert(reqParams); - xsldocloaded = false; - loadXsl(); - req.send(reqParams); - //alert('req sent'); -} - - var xsldocloaded = false; - var xsldoc; - -function loadXsl(){ - if(xslFileName != ''){ - if (window.XSLTProcessor) - { - // support Mozilla/Gecko based browsers - xsldoc = document.implementation.createDocument("", "", null); - xsldoc.addEventListener("load", onXslLoad, false); - xsldoc.load(xslFileName); - //alert("done loadXsl Mozilla"); - htmlunitlimit='false'; - } - else if(window.ActiveXObject) - { - // support Windows / ActiveX - xsldoc = new ActiveXObject("Microsoft.XMLDOM"); - xsldoc.ondataavailable = onXslLoad; - xsldoc.load(xslFileName); - //alert("done loadXsl IE"); - htmlunitlimit='false'; - } - else{ - //alert('setiing htmlunitlimit true'); - htmlunitlimit='true'; - } - } -} - -function onXslLoad() -{ - // flag that the xsl is loaded - xsldocloaded = true; -} - -function resultHandler() -{ - // Make sure the request is loaded (readyState = 4) - if (req.readyState == 4) - { - // Make sure the status is "OK" - if (req.status == 200) - { - // Make sure the XSL document is loaded - if (!xsldocloaded && xslFileName != '') - { - if(htmlunitlimit=='false'){ - alert("Unable to transform data. XSL is not yet loaded."); - // break out of the function - return; - } - else{ - var swappableSectionUT = document.getElementById('msg'); - if(brwsr=='NOIE'){ - //alert('limit case, xsl present, noie'); - swappableSectionUT.removeChild(swappableSectionUT.childNodes[0]);//remove wait message - var x = document.createTextNode(req.responseText); - swappableSectionUT.appendChild(x); - } - else{ - swappableSectionUT.innerHTML = req.responseText; - } - //alert('returning result:'+req.responseText); - return; - } - } - - var swappableSection = document.getElementById("msg"); - - if (window.XSLTProcessor) - { - if(xslFileName == ''){ - swappableSection.removeChild(swappableSection.childNodes[0]);//remove wait message - var x = document.createTextNode(req.responseText); - swappableSection.appendChild(x); - } - else{ - // support Mozilla/Gecko based browsers - var xsltProcessor = new XSLTProcessor(); - xsltProcessor.importStylesheet(xsldoc); - var outputXHTML = xsltProcessor - .transformToFragment(req.responseXML, document); - swappableSection.innerHTML = ""; - swappableSection.appendChild(outputXHTML); - } - } - else if(window.ActiveXObject) - { - if(xslFileName == ''){ - swappableSection.innerHTML = req.responseText; - } - else{ - // support Windows/ActiveX enabled browsers - var outputXHTML = req.responseXML.transformNode(xsldoc); - swappableSection.innerHTML = outputXHTML; - } - } - else{ - var swappableSectionUT = document.getElementById('msg'); - if(brwsr=='NOIE'){ - swappableSectionUT.removeChild(swappableSectionUT.childNodes[0]);//remove wait message - var x = document.createTextNode(req.responseText); - swappableSectionUT.appendChild(x); - } - else{ - swappableSectionUT.innerHTML = req.responseText; - } - return; - } - } - else - { - alert("There was a problem retrieving the XML data:\n" + - req.statusText); - } - } -} diff --git a/java/das/samples/advanced-webapp/src/main/webapp/js/dasmenu.js b/java/das/samples/advanced-webapp/src/main/webapp/js/dasmenu.js deleted file mode 100644 index 96b5d5288e..0000000000 --- a/java/das/samples/advanced-webapp/src/main/webapp/js/dasmenu.js +++ /dev/null @@ -1,112 +0,0 @@ -// -var dbstatus; -var brwsrDB; -var reqDB; - -function showSubMenu(){ - var objThis = this; - - for(var i = 0; i < objThis.childNodes.length; i++) - { - if(objThis.childNodes.item(i).nodeName == "UL") - { - objThis.childNodes.item(i).style.display = "block"; - } - } -} - -function hideSubMenu() -{ - var objThis = this; - - for(var i = 0; i < objThis.childNodes.length; i++) - { - if(objThis.childNodes.item(i).nodeName == "UL") - { - objThis.childNodes.item(i).style.display = "none"; - return; - } - } -} - -function initialiseMenu() -{ - var objLICollection = document.body.getElementsByTagName("LI"); - for(var i = 0; i < objLICollection.length; i++) - { - var objLI = objLICollection[i]; - for(var j = 0; j < objLI.childNodes.length; j++) - { - if(objLI.childNodes.item(j).nodeName == "UL") - { - objLI.onmouseover=showSubMenu; - objLI.onmouseout=hideSubMenu; - - for(var j = 0; j < objLI.childNodes.length; j++) - { - if(objLI.childNodes.item(j).nodeName == "A") - { - objLI.childNodes.item(j).className = "hassubmenu"; - } - } - } - } - } -} - -function refreshdb(){ - if (window.XMLHttpRequest) { - brwsrDB='NOIE'; - reqDB = new XMLHttpRequest(); - } else if (window.ActiveXObject) { - brwsrDB='IE'; - reqDB = new ActiveXObject("Microsoft.XMLHTTP"); - } - - var dbRefreshMsg = document.getElementById('dbmsg'); - if(brwsrDB=='NOIE'){ - var x = document.createTextNode('Refreshing database..please wait'); - dbRefreshMsg.appendChild(x); - } - else{ - dbmsg.innerHTML = 'Refreshing database..please wait'; - } - - //TODO - var urlDB = "../CommandServlet"; - reqDB.open("POST", urlDB, true); - reqDB.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - reqDB.onreadystatechange = dbresultHandler; - reqDB.send('refreshDB=yes'); -} - -function dbresultHandler() { - if (reqDB.readyState == 4) { - if (reqDB.status == 200) { - var dbRefreshMsg = document.getElementById('dbmsg'); - if(brwsrDB=='NOIE'){ - dbRefreshMsg.removeChild(dbRefreshMsg.childNodes[0]);//remove wait message - var x = document.createTextNode('Refreshed database!'); - dbRefreshMsg.appendChild(x); - } - else{ - dbmsg.innerHTML = 'Refreshed database!'; - } - return; - } - } -} diff --git a/java/das/samples/advanced-webapp/src/main/webapp/jsp/DASMenu.jsp b/java/das/samples/advanced-webapp/src/main/webapp/jsp/DASMenu.jsp deleted file mode 100644 index 041e05c8bb..0000000000 --- a/java/das/samples/advanced-webapp/src/main/webapp/jsp/DASMenu.jsp +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - DASMenu: Web Sample - - - - - - -

Tuscany DAS Web Sample

- -

Tuscany DAS web sample demonstrates - simple adhoc queries, DAS predefined commands execution and - some advanced features like Optimistic Concurrency Control (OCC), Converter, Result Set Shape etc. -

-

Check more details by navigating menu. - Press Refresh! button anytime for database refresh. -

- -
- - - - - - -
- - \ No newline at end of file diff --git a/java/das/samples/advanced-webapp/src/main/webapp/jsp/converter.jsp b/java/das/samples/advanced-webapp/src/main/webapp/jsp/converter.jsp deleted file mode 100644 index a3610e7639..0000000000 --- a/java/das/samples/advanced-webapp/src/main/webapp/jsp/converter.jsp +++ /dev/null @@ -1,117 +0,0 @@ - - -<%-- - * 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. - --%> - -<%-- JSTL tags --%> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> -<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> - - - - - - - - - - - -<%@ page import="java.util.*" %> - - - -
- - - - - - - -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 "Pavick" and 1966.12.20 if - the value is "Williams" -
- On write, the converter returns "Williams" if the property value is 1966.12.20 and "Pavick" - if the property value is 1957.09.27 -
- Check using direct database connection that the database table rows's column values are - either "Williams" or "Pavick". -
-
- -Select * from CUSTOMER where ID = 1; -
- -Check First Customer's LastName is 1957.09.27 -
- -Set First Customer's LastName to 1966.12.20 -
- -Check First Customer's LastName is 1966.12.20 -
- - -    - - -
- - - -
 
-
- - -
- -
- - - diff --git a/java/das/samples/advanced-webapp/src/main/webapp/jsp/default.css b/java/das/samples/advanced-webapp/src/main/webapp/jsp/default.css deleted file mode 100644 index 5680fab9ed..0000000000 --- a/java/das/samples/advanced-webapp/src/main/webapp/jsp/default.css +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - */ - -BODY {BACKGROUND-COLOR: #FFFFFF; COLOR: #333366; FONT-FAMILY: 'Times New Roman'} -H1 {COLOR: #6666CC; FONT-FAMILY: 'Times New Roman'; TEXT-TRANSFORM: capitalize } -H2 {COLOR: #6666CC; FONT-FAMILY: 'Times New Roman'; TEXT-TRANSFORM: capitalize } -H3 {COLOR: #6666CC; FONT-FAMILY: 'Times New Roman'; TEXT-TRANSFORM: capitalize } -H4 {COLOR: #6666CC; FONT-FAMILY: 'Times New Roman'; TEXT-TRANSFORM: capitalize } -H5 {COLOR: #6666CC; FONT-FAMILY: 'Times New Roman'; TEXT-TRANSFORM: capitalize } -H6 {COLOR: #6666CC; FONT-FAMILY: 'Times New Roman'; TEXT-TRANSFORM: capitalize } -TH {COLOR: #000000; font-weight: bold } - -#TRowEven {background-color: #ccff99} -#TRowOdd {background-color: #ffffcc} - -A:link {cursor:hand; color: #3300FF; text-decoration: none;} -A:visited {cursor:hand; color: #3300FF; text-decoration: none; } -A:active {cursor:hand; color:#FEAA02; text-decoration: none;} -A:hover {cursor:hand; color:#FEAA02;} diff --git a/java/das/samples/advanced-webapp/src/main/webapp/jsp/indexAdhoc.jsp b/java/das/samples/advanced-webapp/src/main/webapp/jsp/indexAdhoc.jsp deleted file mode 100644 index f212d744f1..0000000000 --- a/java/das/samples/advanced-webapp/src/main/webapp/jsp/indexAdhoc.jsp +++ /dev/null @@ -1,87 +0,0 @@ - - -<%-- - * 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. - --%> - -<%-- JSTL tags --%> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> -<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> - - - - - - - - - - - -<%@ page import="java.util.*" %> - - - -
- - - - - - - -Adhoc SQL Query:
- -    - - -
- - - -
 
-
- -
- -
- - - diff --git a/java/das/samples/advanced-webapp/src/main/webapp/jsp/indexCommand.jsp b/java/das/samples/advanced-webapp/src/main/webapp/jsp/indexCommand.jsp deleted file mode 100644 index 55dcb56e38..0000000000 --- a/java/das/samples/advanced-webapp/src/main/webapp/jsp/indexCommand.jsp +++ /dev/null @@ -1,85 +0,0 @@ - - -<%-- - * 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. - --%> - -<%-- JSTL tags --%> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> -<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> - - - - - - - - - - - -<%@ page import="java.util.*" %> - - - -
- - - - - - - -DAS Command: - - - - - - -
- - -
 
-
- -
- -
- - - diff --git a/java/das/samples/advanced-webapp/src/main/webapp/jsp/main.css b/java/das/samples/advanced-webapp/src/main/webapp/jsp/main.css deleted file mode 100644 index 264facc985..0000000000 --- a/java/das/samples/advanced-webapp/src/main/webapp/jsp/main.css +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - */ - -body -{ - margin: 0px; - border: 0px; - padding: 0px; - font-family: Verdana, Arial, Sans-Serif; - font-size: 0px; -} - -img -{ - border: none 0px #ffffff; -} - -h1 -{ - background-color: #ffcc00; - border-bottom: solid 1px #333333; - padding: 5px; - margin: 0px; - font-size: x-large; -} - -h2 -{ - font-size: large; -} - -p -{ - font-size: small; -} - -/* Real menu */ -ul, li -{ - font-size: small; - margin-top: 0px; - margin-right: 0px; - margin-bottom: 0px; - display: block; -} - -ul -{ - width: 130px; - border: solid 1px #333333; - border-top: solid 5px #333333; - border-right: solid 2px #333333; - padding: 0px; -} - -li ul -{ - display: none; - position: absolute; - margin-left: 100px; - margin-top: -20px; -} - -li a -{ - padding: 2px; - text-decoration: none; - color: #000000; - background-color: #ffffee; - width: 100%; - display: block; - border-bottom: dashed 1px #333333; - text-indent: 2px; - font-size: small; -} - -li a:hover -{ - background-color: #ffcc00; - font-weight: bold; - border-bottom: solid 1px #333333; -} - -li -{ - float: left; - width: 98%; -} - -a.hassubmenu -{ - background-image: url(../img/lay_dmnuhassub.gif); - background-repeat: no-repeat; - background-position: 120px 7px; -} - -#mainmenu -{ - margin: 10px; - margin-left: 5px; - float: left; - border-bottom: solid 2px #333333; - margin-bottom: 100%; -} \ No newline at end of file diff --git a/java/das/samples/advanced-webapp/src/main/webapp/jsp/occ.jsp b/java/das/samples/advanced-webapp/src/main/webapp/jsp/occ.jsp deleted file mode 100644 index ed5a7ee0c1..0000000000 --- a/java/das/samples/advanced-webapp/src/main/webapp/jsp/occ.jsp +++ /dev/null @@ -1,77 +0,0 @@ - - -<%-- - * 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. - --%> - -<%-- JSTL tags --%> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> -<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> - - - - - - - - - - - -<%@ page import="java.util.*" %> - - - -
- - - - - - - -Automatic Optimistic Concurrency Control: - Try to modify same column in same database table row twice in one transaction. -
- - -    - - -
- - - -
 
-
- -
- -
- - - diff --git a/java/das/samples/advanced-webapp/src/main/webapp/jsp/rss.jsp b/java/das/samples/advanced-webapp/src/main/webapp/jsp/rss.jsp deleted file mode 100644 index 2d217d68b3..0000000000 --- a/java/das/samples/advanced-webapp/src/main/webapp/jsp/rss.jsp +++ /dev/null @@ -1,78 +0,0 @@ - - -<%-- - * 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. - --%> - -<%-- JSTL tags --%> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> -<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> - - - - - - - - - - - -<%@ page import="java.util.*" %> - - - -
- - - - - - - -Result Set Shape: - DAS has 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. -
-
- -(Select 99, 'Roosevelt', '1600 Pennsylvania Avenue' from customer) - -    - - -
- - - -
 
-
- -
- -
- - - diff --git a/java/das/samples/advanced-webapp/src/main/webapp/xsl/company.xsl b/java/das/samples/advanced-webapp/src/main/webapp/xsl/company.xsl deleted file mode 100644 index 99d9dc1fad..0000000000 --- a/java/das/samples/advanced-webapp/src/main/webapp/xsl/company.xsl +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - -

Query Result

- - - -
- - - - - - - - - - -
COMPANYIDCOMPANYNAME
- - - -
-
-
diff --git a/java/das/samples/advanced-webapp/src/main/webapp/xsl/companyDepartment.xsl b/java/das/samples/advanced-webapp/src/main/webapp/xsl/companyDepartment.xsl deleted file mode 100644 index f79d30595e..0000000000 --- a/java/das/samples/advanced-webapp/src/main/webapp/xsl/companyDepartment.xsl +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - -

Query Result

- - - -
- - - - - - - - - - -
COMPANYIDCOMPANYNAME
- - - -
- - - - - - - - - - - - -
DEPIDDEPNAME
- - - -
- - - -
-
diff --git a/java/das/samples/advanced-webapp/src/main/webapp/xsl/customer.xsl b/java/das/samples/advanced-webapp/src/main/webapp/xsl/customer.xsl deleted file mode 100644 index 40e260bcce..0000000000 --- a/java/das/samples/advanced-webapp/src/main/webapp/xsl/customer.xsl +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - -

Query Result

- - - - - - - - - - - - - - - -
IDLASTNAMEADDRESS
- - - - - -
- - -
-
diff --git a/java/das/samples/build.xml b/java/das/samples/build.xml deleted file mode 100644 index f78ca9a3c8..0000000000 --- a/java/das/samples/build.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - diff --git a/java/das/samples/company-webapp/build.xml b/java/das/samples/company-webapp/build.xml deleted file mode 100644 index dd269b628e..0000000000 --- a/java/das/samples/company-webapp/build.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/das/samples/company-webapp/dastest/db.lck b/java/das/samples/company-webapp/dastest/db.lck deleted file mode 100644 index 9f6b4b3d4b..0000000000 Binary files a/java/das/samples/company-webapp/dastest/db.lck and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/log/log.ctrl b/java/das/samples/company-webapp/dastest/log/log.ctrl deleted file mode 100644 index edbd775299..0000000000 Binary files a/java/das/samples/company-webapp/dastest/log/log.ctrl and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/log/log1.dat b/java/das/samples/company-webapp/dastest/log/log1.dat deleted file mode 100644 index 7e85ac8e8f..0000000000 Binary files a/java/das/samples/company-webapp/dastest/log/log1.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/log/logmirror.ctrl b/java/das/samples/company-webapp/dastest/log/logmirror.ctrl deleted file mode 100644 index edbd775299..0000000000 Binary files a/java/das/samples/company-webapp/dastest/log/logmirror.ctrl and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c10.dat b/java/das/samples/company-webapp/dastest/seg0/c10.dat deleted file mode 100644 index 5d8ecaa10f..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c10.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c101.dat b/java/das/samples/company-webapp/dastest/seg0/c101.dat deleted file mode 100644 index 0f79fa7574..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c101.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c111.dat b/java/das/samples/company-webapp/dastest/seg0/c111.dat deleted file mode 100644 index 39d49e3d19..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c111.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c121.dat b/java/das/samples/company-webapp/dastest/seg0/c121.dat deleted file mode 100644 index 2a4311779b..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c121.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c130.dat b/java/das/samples/company-webapp/dastest/seg0/c130.dat deleted file mode 100644 index 64e3c18d62..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c130.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c141.dat b/java/das/samples/company-webapp/dastest/seg0/c141.dat deleted file mode 100644 index 0632d04164..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c141.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c150.dat b/java/das/samples/company-webapp/dastest/seg0/c150.dat deleted file mode 100644 index d7541026f6..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c150.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c161.dat b/java/das/samples/company-webapp/dastest/seg0/c161.dat deleted file mode 100644 index 6673bf1873..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c161.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c171.dat b/java/das/samples/company-webapp/dastest/seg0/c171.dat deleted file mode 100644 index c2a753cc5d..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c171.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c180.dat b/java/das/samples/company-webapp/dastest/seg0/c180.dat deleted file mode 100644 index cb9391aed1..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c180.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c191.dat b/java/das/samples/company-webapp/dastest/seg0/c191.dat deleted file mode 100644 index d3cf1d6364..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c191.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c1a1.dat b/java/das/samples/company-webapp/dastest/seg0/c1a1.dat deleted file mode 100644 index a7a2d536e9..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c1a1.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c1b1.dat b/java/das/samples/company-webapp/dastest/seg0/c1b1.dat deleted file mode 100644 index 19097e69e7..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c1b1.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c1c0.dat b/java/das/samples/company-webapp/dastest/seg0/c1c0.dat deleted file mode 100644 index 359525a31a..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c1c0.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c1d1.dat b/java/das/samples/company-webapp/dastest/seg0/c1d1.dat deleted file mode 100644 index 9f257df932..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c1d1.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c1e0.dat b/java/das/samples/company-webapp/dastest/seg0/c1e0.dat deleted file mode 100644 index e43e52fb7f..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c1e0.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c1f1.dat b/java/das/samples/company-webapp/dastest/seg0/c1f1.dat deleted file mode 100644 index 7e6ee3b1e0..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c1f1.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c20.dat b/java/das/samples/company-webapp/dastest/seg0/c20.dat deleted file mode 100644 index 1be6390f06..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c20.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c200.dat b/java/das/samples/company-webapp/dastest/seg0/c200.dat deleted file mode 100644 index b15d56855c..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c200.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c211.dat b/java/das/samples/company-webapp/dastest/seg0/c211.dat deleted file mode 100644 index 84b0022312..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c211.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c221.dat b/java/das/samples/company-webapp/dastest/seg0/c221.dat deleted file mode 100644 index 63106a9523..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c221.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c230.dat b/java/das/samples/company-webapp/dastest/seg0/c230.dat deleted file mode 100644 index 9975f27c1f..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c230.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c241.dat b/java/das/samples/company-webapp/dastest/seg0/c241.dat deleted file mode 100644 index 835c645a16..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c241.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c251.dat b/java/das/samples/company-webapp/dastest/seg0/c251.dat deleted file mode 100644 index d3d6adf4fb..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c251.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c260.dat b/java/das/samples/company-webapp/dastest/seg0/c260.dat deleted file mode 100644 index 8d7333df7d..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c260.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c271.dat b/java/das/samples/company-webapp/dastest/seg0/c271.dat deleted file mode 100644 index af722f7d73..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c271.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c281.dat b/java/das/samples/company-webapp/dastest/seg0/c281.dat deleted file mode 100644 index 3972983c2e..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c281.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c290.dat b/java/das/samples/company-webapp/dastest/seg0/c290.dat deleted file mode 100644 index 31577b8124..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c290.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c2a1.dat b/java/das/samples/company-webapp/dastest/seg0/c2a1.dat deleted file mode 100644 index 0f700d13a7..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c2a1.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c2b1.dat b/java/das/samples/company-webapp/dastest/seg0/c2b1.dat deleted file mode 100644 index 1d6382fb3d..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c2b1.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c2c1.dat b/java/das/samples/company-webapp/dastest/seg0/c2c1.dat deleted file mode 100644 index 3bc60d886b..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c2c1.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c2d0.dat b/java/das/samples/company-webapp/dastest/seg0/c2d0.dat deleted file mode 100644 index c542d3c91c..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c2d0.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c2e1.dat b/java/das/samples/company-webapp/dastest/seg0/c2e1.dat deleted file mode 100644 index 16abd20b5f..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c2e1.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c2f0.dat b/java/das/samples/company-webapp/dastest/seg0/c2f0.dat deleted file mode 100644 index eb26be5932..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c2f0.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c300.dat b/java/das/samples/company-webapp/dastest/seg0/c300.dat deleted file mode 100644 index 1214f1df4b..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c300.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c31.dat b/java/das/samples/company-webapp/dastest/seg0/c31.dat deleted file mode 100644 index 18c16f1123..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c31.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c311.dat b/java/das/samples/company-webapp/dastest/seg0/c311.dat deleted file mode 100644 index 926cbf25b5..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c311.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c320.dat b/java/das/samples/company-webapp/dastest/seg0/c320.dat deleted file mode 100644 index 07e7bc023c..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c320.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c331.dat b/java/das/samples/company-webapp/dastest/seg0/c331.dat deleted file mode 100644 index fd827f9dc2..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c331.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c340.dat b/java/das/samples/company-webapp/dastest/seg0/c340.dat deleted file mode 100644 index ca70319886..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c340.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c351.dat b/java/das/samples/company-webapp/dastest/seg0/c351.dat deleted file mode 100644 index 8fbe2a527c..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c351.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c360.dat b/java/das/samples/company-webapp/dastest/seg0/c360.dat deleted file mode 100644 index dcf9c746e1..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c360.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c371.dat b/java/das/samples/company-webapp/dastest/seg0/c371.dat deleted file mode 100644 index 6f21a840ea..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c371.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c380.dat b/java/das/samples/company-webapp/dastest/seg0/c380.dat deleted file mode 100644 index b512e8065f..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c380.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c391.dat b/java/das/samples/company-webapp/dastest/seg0/c391.dat deleted file mode 100644 index 27006e95a1..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c391.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c3a0.dat b/java/das/samples/company-webapp/dastest/seg0/c3a0.dat deleted file mode 100644 index 565dca97ac..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c3a0.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c3b1.dat b/java/das/samples/company-webapp/dastest/seg0/c3b1.dat deleted file mode 100644 index 36894c9818..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c3b1.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c3c0.dat b/java/das/samples/company-webapp/dastest/seg0/c3c0.dat deleted file mode 100644 index d0c538aede..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c3c0.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c3d1.dat b/java/das/samples/company-webapp/dastest/seg0/c3d1.dat deleted file mode 100644 index 65bcec5527..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c3d1.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c3e0.dat b/java/das/samples/company-webapp/dastest/seg0/c3e0.dat deleted file mode 100644 index bdab359420..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c3e0.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c3f1.dat b/java/das/samples/company-webapp/dastest/seg0/c3f1.dat deleted file mode 100644 index dc2d278b57..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c3f1.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c400.dat b/java/das/samples/company-webapp/dastest/seg0/c400.dat deleted file mode 100644 index 3072709cec..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c400.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c41.dat b/java/das/samples/company-webapp/dastest/seg0/c41.dat deleted file mode 100644 index 61086690f2..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c41.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c411.dat b/java/das/samples/company-webapp/dastest/seg0/c411.dat deleted file mode 100644 index ca551d8249..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c411.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c420.dat b/java/das/samples/company-webapp/dastest/seg0/c420.dat deleted file mode 100644 index f04de0840e..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c420.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c431.dat b/java/das/samples/company-webapp/dastest/seg0/c431.dat deleted file mode 100644 index 398b1672cc..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c431.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c440.dat b/java/das/samples/company-webapp/dastest/seg0/c440.dat deleted file mode 100644 index af259d0872..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c440.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c451.dat b/java/das/samples/company-webapp/dastest/seg0/c451.dat deleted file mode 100644 index 772a18c658..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c451.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c460.dat b/java/das/samples/company-webapp/dastest/seg0/c460.dat deleted file mode 100644 index 505428362d..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c460.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c471.dat b/java/das/samples/company-webapp/dastest/seg0/c471.dat deleted file mode 100644 index 484d0df42d..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c471.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c481.dat b/java/das/samples/company-webapp/dastest/seg0/c481.dat deleted file mode 100644 index faac073076..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c481.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c490.dat b/java/das/samples/company-webapp/dastest/seg0/c490.dat deleted file mode 100644 index 7585319d21..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c490.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c4a1.dat b/java/das/samples/company-webapp/dastest/seg0/c4a1.dat deleted file mode 100644 index 4fe8b786e3..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c4a1.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c51.dat b/java/das/samples/company-webapp/dastest/seg0/c51.dat deleted file mode 100644 index 7fc7937b15..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c51.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c60.dat b/java/das/samples/company-webapp/dastest/seg0/c60.dat deleted file mode 100644 index d1fb08c946..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c60.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c71.dat b/java/das/samples/company-webapp/dastest/seg0/c71.dat deleted file mode 100644 index d4c2090a3b..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c71.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c81.dat b/java/das/samples/company-webapp/dastest/seg0/c81.dat deleted file mode 100644 index 38b6ea6520..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c81.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/c90.dat b/java/das/samples/company-webapp/dastest/seg0/c90.dat deleted file mode 100644 index a607a5969c..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/c90.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/ca1.dat b/java/das/samples/company-webapp/dastest/seg0/ca1.dat deleted file mode 100644 index 19b4c9e340..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/ca1.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/cb1.dat b/java/das/samples/company-webapp/dastest/seg0/cb1.dat deleted file mode 100644 index 73dc986572..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/cb1.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/cc0.dat b/java/das/samples/company-webapp/dastest/seg0/cc0.dat deleted file mode 100644 index d1eef3bb56..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/cc0.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/cd1.dat b/java/das/samples/company-webapp/dastest/seg0/cd1.dat deleted file mode 100644 index c7e6db3ef7..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/cd1.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/ce1.dat b/java/das/samples/company-webapp/dastest/seg0/ce1.dat deleted file mode 100644 index 8fd3bf17a8..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/ce1.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/seg0/cf0.dat b/java/das/samples/company-webapp/dastest/seg0/cf0.dat deleted file mode 100644 index 332b3d9a8a..0000000000 Binary files a/java/das/samples/company-webapp/dastest/seg0/cf0.dat and /dev/null differ diff --git a/java/das/samples/company-webapp/dastest/service.properties b/java/das/samples/company-webapp/dastest/service.properties deleted file mode 100644 index 8cfe3b09a5..0000000000 --- a/java/das/samples/company-webapp/dastest/service.properties +++ /dev/null @@ -1,22 +0,0 @@ -#C:\apacheSVN\java\target\dastest -# ******************************************************************** -# *** Please do NOT edit this file. *** -# *** CHANGING THE CONTENT OF THIS FILE MAY CAUSE DATA CORRUPTION. *** -# ******************************************************************** -#Fri Feb 17 08:55:29 MST 2006 -SysschemasIndex2Identifier=225 -SyscolumnsIdentifier=144 -SysconglomeratesIndex1Identifier=49 -SysconglomeratesIdentifier=32 -SyscolumnsIndex2Identifier=177 -SysschemasIndex1Identifier=209 -SysconglomeratesIndex3Identifier=81 -SystablesIndex2Identifier=129 -SyscolumnsIndex1Identifier=161 -derby.serviceProtocol=org.apache.derby.database.Database -SysschemasIdentifier=192 -derby.storage.propertiesId=16 -SysconglomeratesIndex2Identifier=65 -derby.serviceLocale=en_US -SystablesIdentifier=96 -SystablesIndex1Identifier=113 diff --git a/java/das/samples/company-webapp/pom.xml b/java/das/samples/company-webapp/pom.xml deleted file mode 100644 index 5cab332043..0000000000 --- a/java/das/samples/company-webapp/pom.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.das.samples - tuscany-das-samples - 1.0-SNAPSHOT - - - tuscany-das-sample-company-webapp - war - Tuscany DAS Company Sample - Sample use of RDB DAS in a Web application - - - - org.apache.tuscany.das - tuscany-das-rdb - ${das.version} - compile - - - - org.apache.tuscany.sdo - tuscany-sdo-impl - ${sdo.version} - compile - - - - org.apache.tuscany.sdo - tuscany-sdo-api-r2.1 - ${sdo.version} - compile - - - - org.apache.tuscany.das.samples - tuscany-das-sample-dbconfig - ${das.version} - compile - - - org.apache.derby - derby - - - - - - javax.servlet - servlet-api - 2.5 - provided - - - - - - sample-company-webapp - src/main/java - - - src/main/java - - - src/main/resources - - - - diff --git a/java/das/samples/company-webapp/readme.htm b/java/das/samples/company-webapp/readme.htm deleted file mode 100644 index f632162b2a..0000000000 --- a/java/das/samples/company-webapp/readme.htm +++ /dev/null @@ -1,201 +0,0 @@ - - - - - -Tuscany DAS Sample - Company webapp - - - - - - - -

DAS Company web application Sample

- -
-
- -

-This stand-alone sample demonstrates the SDO RDB Data Access Service in the context of a simple web application
-

-

-The application starts with a database of Companies and their related Departments.Through the web page interface, a user can:
-
- -

    -
  1. Display all Companies in the database
  2. -
  3. Display all Companies and related Departments
  4. -
  5. Add a new Department to a Company
  6. -
  7. Delete all Departments from a Company
  8. -
  9. Change the names of Departments in a Company
  10. -
- -

This simple application covers all CRUD operations as well as some relationship manipulation (adding a Department associates that -Department with the Company).The sample runs on Tomcat 6.0 and employs a Derby database (default) accessed via a DataSource.

- -

Running the sample

- -

There are two options for running this sample:

- -
    -
  1. Run from Tomcat configured by the build
  2. -
  3. Deploying the Company-webapp WAR into a Tomcat you configure yourself
  4. -
- -

Running from Tomcat configured by the build

- -

-You need to download the Tuscany RDB DAS source distribution and run maven build to use this option. -When you build using maven from the source root {SRC_ROOT} directory, the sample war file is created -under {SRC_ROOT}/samples/company-webapp/target. This sample application is deployed to an instance -of Tomcat as part of our automated sample testing. For this, follow readme.htm instructions from -{SRC_ROOT}/samples/testing/tomcat. This will in-effect run the htmlunit tests on the sample. -The sample deployed on Tomcat instance will be ready this way and you can just point your browser -to http://localhost:8080/sample-company-webapp/ -to test further. -

- -

Deploying the Company-webapp WAR into a Tomcat you configured yourself

- -

-Alternatively, you can deploy the sample to your own configured Tomcat installation by following -the instructions below.These instructions assume that you have either 1) downloaded the Tuscany -binary distribution or 2) Downloaded the Tuscany source and run maven build.See the following -link for more details steps on how to build DAS Sample applications -http://incubator.apache.org/tuscany/das-java-developer-guide.html. -

- -Set Up - Derby - -
    -
  • Download and install the most recent stable version of Tomcat 5.5 or Tomcat 6. You can find it here: http://tomcat.apache.org/download-60.cgi
  • -
  • Download the most recent official release of Derby from here: http://db.apache.org/derby/index.html. The only file you'll need from this download is derby(version).jar
  • -
  • Stop Tomcat
  • -
  • Copy derby(version).jar (from the derby distribution) to {Tomcat_Home}/common/lib (for Tomcat 5.5) or to {Tomcat_Home}/lib (for Tomcat 6) - e.g. derby-10.2.2.0.jar.
  • -
  • Add the sample war file to {Tomcat_Home}/webapps -
      -
    • sample-company-webapp.war
    • -
    -
  • -
  • Define a DataSource by adding a datasource definition to {Tomcat_Home}/conf/server.xml. -
      -
    • Find the end-of-section marker and add the following lines just above it:
    • -
    - -
    -        <!-- Global Datasource for Derby dastest database -->
    -        <Resource name="jdbc/dastest"
    -                  type="javax.sql.DataSource" auth="Container"
    -                  description="Derby database for DAS Company sample"
    -                  maxActive="100" maxIdle="30" maxWait="10000"
    -                  username="" password=""
    -                  driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
    -                  url="jdbc:derby:{absolute path}Databases/dastest;create=true"/>
    -        
    - - Requirement: You must include the absolute path to the Databases directory in the above url attribute.
    - Fore example: <url="jdbc:derby:c:\apache-tomcat-6.0.13\Databases/ajaxdastest;create=true"/> -

    - As the new utility, dbConfig is embedded in this sample war, the Derby database "dastest" will get - created with required tables and data when the web application gets loaded for the first time in tomcat. -

    -
  • -
  • Start tomcat and point your browser to: http://localhost:8080/sample-company-webapp/
  • -
- - -Set Up - MySQL - -
    -
  • Download and install the most recent stable version of Tomcat 5.5 or Tomcat 6. You can find it here: http://tomcat.apache.org/download-60.cgi
  • -
  • Download the most recent official release of MySQL driver, e.g. mysql-connector-java-5.0.4.jar
  • -
  • Stop Tomcat
  • -
  • Copy mysql(version).jar (from the MySQL distribution) to {Tomcat_Home}/common/lib (for Tomcat 5.5) or to {Tomcat_Home}/lib (for Tomcat 6) - e.g. mysql-connector-java-5.0.4.jar.
  • -
  • Add the sample war file to {Tomcat_Home}/webapps -
      -
    • sample-company-webapp.war
    • -
    -
  • -
  • Define a DataSource by adding a datasource definition to {Tomcat_Home}/conf/server.xml. -
      -
    • Find the end-of-section marker and add the following lines just above it:
    • -
    - -
    -        <!-- Global Datasource for MySQL dastest database -->
    -        <Resource name="jdbc/dastest"
    -                  type="javax.sql.DataSource" auth="Container"
    -                  description="MySQL database for DAS Company sample"
    -                  maxActive="100" maxIdle="30" maxWait="10000"
    -                  username="dastest" password="dastest"
    -                  driverClassName="com.mysql.jdbc.Driver"
    -                  url="jdbc:mysql://localhost/dastest?createDatabaseIfNotExist=true"/>
    -        
    - - Requirement:MySQL service should be up with configured port open for TCPIP communication.
    -

    - As the new utility, dbConfig is embedded in this sample war, the MySQL database "dastest" will get created with - required tables and data when the web application gets loaded for the first time in tomcat. Please note that, - in the binary distribution, WEB-INF/classes/CompanyWebDBConfig.xml has SQL Table creation syntax for Derby. - To make it compatible to MySQL, simply replace GENERATED ALWAYS AS IDENTITY with AUTO_INCREMENT for all - table creation statements. (For this unjar the .war, change CompanyWebDBConfig.xml and jar the .war - back with changed CompanyWebDBConfig.xml) -
    -
    -
  • -
  • Start tomcat and point your browser to: http://localhost:8080/sample-advanced-webapp/
  • -
- - -

Sample Architecture

- -

-This is a simple, single-page, web application.The main components of this application are: -

- -
    -
  • The RDB Data Access Service (DAS)
  • -
  • SDO
  • -
  • CompanyClient.java
  • -
  • Company.jsp
  • -
- -

The CompanyClient uses the DAS directly and provides high-level services to the jsp such as:

-

public final List getCompanies()

- -

This is a good place to look for how you might use the DAS in your own application.

- -

The Company.jsp responds to client interaction by invoking services of the CompanyClient.It receives data -from the CompanyClient as SDO data graphs and manipulates SDOs directly to display data.

- -

The DAS accepts directives (commands) from the CompanyClient and reads and writes to the derby -database instance appropriately.

- - - - diff --git a/java/das/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyClient.java b/java/das/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyClient.java deleted file mode 100644 index d0519ecc08..0000000000 --- a/java/das/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyClient.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.samples.das.companyweb; - -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; - -import commonj.sdo.DataObject; - -public class CompanyClient { - - private Random generator = new Random(); - - private DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml")); - - public final List getCompanies() { - - Command read = das.getCommand("all companies"); - DataObject root = read.executeQuery(); - return root.getList("COMPANY"); - - } - - public final List getCompaniesWithDepartments() { - - Command read = das.getCommand("all companies and departments"); - DataObject root = read.executeQuery(); - return root.getList("COMPANY"); - } - - public final List getDepartmentsForCompany(int id) { - Command read = das.getCommand("all departments for company"); - read.setParameter(1, new Integer(id)); - DataObject root = read.executeQuery(); - return root.getList("COMPANY"); - } - - public final void addDepartmentToFirstCompany() { - Command read = das.getCommand("all companies and departments"); - DataObject root = read.executeQuery(); - DataObject firstCustomer = root.getDataObject("COMPANY[1]"); - - DataObject newDepartment = root.createDataObject("DEPARTMENT"); - newDepartment.setString("NAME", "Default Name"); - firstCustomer.getList("departments").add(newDepartment); - - das.applyChanges(root); - - } - - public final void deleteDepartmentsFromFirstCompany() { - - // This section gets the ID of the first Company just so I can - // demonstrate a parameterized command next - Command readAll = das.getCommand("all companies and departments"); - DataObject root = readAll.executeQuery(); - int idOfFirstCustomer = root.getInt("COMPANY[1]/ID"); - System.out.println("ID of first company is: " + idOfFirstCustomer); - - // Read a specific company based on the known ID - Command readCust = das.getCommand("company by id with departments"); - readCust.setParameter(1, new Integer(idOfFirstCustomer)); - root = readCust.executeQuery(); - - // Delete all the comany's departments from the graph - DataObject firstCustomer = root.getDataObject("COMPANY[1]"); - - // Shallow copy of list for deleting. This is required to avoid the - // dreaded - // ConcurrentModificationException since #delete operation also removes - // from the original list - List allDepartments = new ArrayList(firstCustomer.getList("departments")); - - Iterator i = allDepartments.iterator(); - DataObject department; - while (i.hasNext()) { - department = (DataObject) i.next(); - System.out.println("Deleting department named: " + department.getString("NAME")); - department.delete(); - } - - das.applyChanges(root); - - } - - public final void changeFirstCompanysDepartmentNames() { - - // This section gets the ID of the first Company just so I can - // demonstrate a parameterized command next - Command readAll = das.getCommand("all companies and departments"); - DataObject root = readAll.executeQuery(); - int idOfFirstCustomer = root.getInt("COMPANY[1]/ID"); - System.out.println("ID of first company is: " + idOfFirstCustomer); - - // Read a specific company based on the known ID - Command readCust = das.getCommand("company by id with departments"); - readCust.setParameter(1, new Integer(idOfFirstCustomer)); - root = readCust.executeQuery(); - - // Modify all the comany's department names - DataObject firstCustomer = root.getDataObject("COMPANY[1]"); - Iterator i = firstCustomer.getList("departments").iterator(); - DataObject department; - while (i.hasNext()) { - department = (DataObject) i.next(); - System.out.println("Modifying department: " + department.getString("NAME")); - department.setString("NAME", getRandomDepartmentName()); - } - das.applyChanges(root); - - } - - - public void releaseResources() { - das.releaseResources(); - } - - // Utilities - - private String getRandomDepartmentName() { - int number = generator.nextInt(1000) + 1; - return "Dept-" + number; - } - - private InputStream getConfig(String fileName) { - return getClass().getClassLoader().getResourceAsStream(fileName); - } - -} diff --git a/java/das/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyDBInit.java b/java/das/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyDBInit.java deleted file mode 100644 index edd62e6f30..0000000000 --- a/java/das/samples/company-webapp/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyDBInit.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.samples.das.companyweb; - -import java.io.IOException; -import java.io.InputStream; -import java.io.PrintWriter; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.tuscany.das.rdb.dbconfig.DBInitializer; - -public class CompanyDBInit extends HttpServlet { - private static final long serialVersionUID = -4795999792460944805L; - private static final String dbConfigFile = "CompanyWebDBConfig.xml"; - - public void init() throws ServletException { - try { - DBInitializer dbInitializer; - dbInitializer = new DBInitializer(getConfig(dbConfigFile)); - if (! dbInitializer.isDatabaseReady()) { - dbInitializer.initializeDatabase(true); - } - } catch (Exception e) { - - e.printStackTrace(); - log(e.toString(), e); - throw new ServletException(e); - } - } - - /* - * (non-Java-doc) - * - * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest arg0, HttpServletResponse arg1) - */ - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - response.setContentType("text/html"); - - PrintWriter out = response.getWriter(); - - out.println(); - out.println("

CompanyWeb database initialization servlet !

"); - out.println(); - } - - private InputStream getConfig(String fileName) { - return getClass().getClassLoader().getResourceAsStream(fileName); - } - -} diff --git a/java/das/samples/company-webapp/src/main/resources/CompanyConfig.xml b/java/das/samples/company-webapp/src/main/resources/CompanyConfig.xml deleted file mode 100644 index a674724323..0000000000 --- a/java/das/samples/company-webapp/src/main/resources/CompanyConfig.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - -
- - - -
- - - - - - -
diff --git a/java/das/samples/company-webapp/src/main/resources/CompanyWebDBConfig.xml b/java/das/samples/company-webapp/src/main/resources/CompanyWebDBConfig.xml deleted file mode 100644 index c064045fd5..0000000000 --- a/java/das/samples/company-webapp/src/main/resources/CompanyWebDBConfig.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - 'ACME Publishing' - 'Do-rite plumbing' - 'MegaCorp' -
- - 'Advanced Technologies', 'NY', '123', 1 - 'Default Name 2', '', '', 1 - 'Default Name 3', '', '', 1 - 'Default Name 4', '', '', 1 - 'Default Name 5', '', '', 1 - 'Default Name 6', '', '', 1 - 'Default Name 7', '', '', 1 - 'Default Name 8', '', '', 1 -
- - 'John Jones','E0001',0,1 - 'Mary Smith','E0002',1,null - 'Jane Doe','E0003',0,1 - 'Al Smith','E0004',1,1 -
-
diff --git a/java/das/samples/company-webapp/src/main/resources/META-INF/LICENSE b/java/das/samples/company-webapp/src/main/resources/META-INF/LICENSE deleted file mode 100644 index 9597d92eb3..0000000000 --- a/java/das/samples/company-webapp/src/main/resources/META-INF/LICENSE +++ /dev/null @@ -1,353 +0,0 @@ - - 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. - -=============================================================================================================== - -Other components and dependencies under Apache Software License 2.0 : - - log4j-1.2.14.jar - Apache Logging Services - derby 10.2.2.0.jar - Apache Derby - stax-api-1.0.1.jar - The Streaming API for XML (StAX) - wstx-asl-3.2.0.jar - WoodStox StAX implementation - standard-1.1.1.jar - The Apache Jackarta Taglibs - jstl-1.1.2.jar - The Apache Jackarta Taglibs - *.tld - The Apache Jackarta Taglibs - -=============================================================================================================== - - -Apache Tuscany SDO for Java Subcomponents -=========================================: - -The Tuscany SDO for Java release 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. - -License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar) - -Permission to copy, make derivative works of, and distribute the Service Data Objects -JavaDoc and Interface Definition Files files in any medium without fee or royalty as part -of a compliant implementation of the Service Data Objects Specification is hereby granted. -The Service Data Objects Specification may be found at any of the following locations: - -http://dev2dev.bea.com/technologies/commonj/index.jsp -http://www.ibm.com/developerworks/library/specification/ws-sdo/ -http://oracle.com/technology/webservices/sca -https://www.sdn.sap.com/ -http://www.xcalia/xdn/specs/sdo - -THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES -ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS -SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS, -INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, -NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE -SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES. - -The name and trademarks of the Authors may NOT be used in any manner, including advertising or -publicity pertaining to the Service Component Architecture Specification or its contents without specific, -written prior permission. Title to copyright in the Service Data Objects Specification and the -JavaDoc and Interface Definition Files will at all times remain with the Authors. - -No other rights are granted by implication, estoppel or otherwise. - -================================================================================================================= - -For the Eclipse EMF components -(codegen-2.2.3.jar -codegen-ecore-2.2.3.jar -common-2.2.3.jar -ecore-2.2.3.jar -ecore-change-2.2.3.jar -ecore-xmi-2.2.3.jar -xsd-2.2.3.jar) - -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. - -=================================================================================================== diff --git a/java/das/samples/company-webapp/src/main/resources/META-INF/NOTICE b/java/das/samples/company-webapp/src/main/resources/META-INF/NOTICE deleted file mode 100644 index e9d98fc7f5..0000000000 --- a/java/das/samples/company-webapp/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,32 +0,0 @@ -Apache Tuscany SDO for Java -Copyright 2006, 2007 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - -Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF), -sponsored by the Apache 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. - -Unless otherwise indicated, all distribution made available by the Apache Software Foundation -is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL"). -A copy of the AL is provided with this distribution as the LICENSE.txt file present in the -root directory, and is also available at http://www.apache.org/licenses/. - -The terms and conditions governing the distribution may refer to the AL or other license -agreements, notices or terms and conditions. Some of these other license agreements may -include (but are not limited to): - - . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html) - -It is your obligation to read and accept all such terms and conditions prior to use of the -distribution. If term or condition is provided, please contact the Apache Software Foundation -to determine what terms and conditions govern that particular distribution. - -This product also includes software developed by the Open Service Oriented Architecture organisation -(http://osoa.org). The license for this software may be found in the LICENSE.txt file contained in this -distribution. diff --git a/java/das/samples/company-webapp/src/main/resources/META-INF/README b/java/das/samples/company-webapp/src/main/resources/META-INF/README deleted file mode 100644 index 107de8c3ca..0000000000 --- a/java/das/samples/company-webapp/src/main/resources/META-INF/README +++ /dev/null @@ -1,35 +0,0 @@ -Apache Tuscany M2 build (October, 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/java/das/samples/company-webapp/src/main/resources/log4j.properties b/java/das/samples/company-webapp/src/main/resources/log4j.properties deleted file mode 100644 index ab4ebbb785..0000000000 --- a/java/das/samples/company-webapp/src/main/resources/log4j.properties +++ /dev/null @@ -1,36 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=INFO, NULL - -# NULL Appender -log4j.appender.NULL=org.apache.log4j.varia.NullAppender - -log4j.appender.NULL.layout=org.apache.log4j.PatternLayout -log4j.appender.NULL.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n - -# CONSOLE is set to be a ConsoleAppender. -log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout -log4j.appender.CONSOLE.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n - - -# Print only messages of level WARN or above in the package com.foo. -log4j.logger.org.apache.tuscany=NONE \ No newline at end of file diff --git a/java/das/samples/company-webapp/src/main/webapp/Company.jsp b/java/das/samples/company-webapp/src/main/webapp/Company.jsp deleted file mode 100644 index 9b74f0a357..0000000000 --- a/java/das/samples/company-webapp/src/main/webapp/Company.jsp +++ /dev/null @@ -1,155 +0,0 @@ - - - - -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" - import="commonj.sdo.*" - - import="org.apache.tuscany.samples.das.companyweb.CompanyClient" -%> - -Company Test - - - -

Tuscany DAS Companies WEB Example

- - -
- - - - - -
- - -<%if(request.getParameter("doFill") != null){%> - - - - - - - - - - - <% - CompanyClient companyClient = new CompanyClient(); - java.util.Iterator i = companyClient.getCompaniesWithDepartments().iterator(); - while (i.hasNext()) { - DataObject company = (DataObject)i.next(); - %> - - - - - <% - } - companyClient.releaseResources(); - %> - - -
IDName
<%=company.getInt("ID")%><%=company.getString("NAME")%>
-<%}%> - - - -<% -if(request.getParameter("doAddDepartment") != null){ - CompanyClient companyClient = new CompanyClient(); - companyClient.addDepartmentToFirstCompany(); - companyClient.releaseResources(); -} -%> - - -<% -if(request.getParameter("doDeleteDepartments") != null){ - CompanyClient companyClient = new CompanyClient(); - companyClient.deleteDepartmentsFromFirstCompany(); - companyClient.releaseResources(); -} -%> - - -<% -if(request.getParameter("doChangeDepartmentNames") != null){ - CompanyClient companyClient = new CompanyClient(); - companyClient.changeFirstCompanysDepartmentNames(); - companyClient.releaseResources(); -} -%> - - - -<%if(request.getParameter("doFill") == null) {%> - - - - - - - - - - - - - <% - CompanyClient companyClient = new CompanyClient(); - java.util.Iterator i = companyClient.getCompaniesWithDepartments().iterator(); - while (i.hasNext()) { - DataObject company = (DataObject)i.next(); - %> - - - - - - - - <% - java.util.Iterator j = company.getList("departments").iterator(); - while (j.hasNext()) { - DataObject department = (DataObject)j.next(); - %> - - - - - <% - } - %> - <% - } - companyClient.releaseResources(); - %> - - -
IDNameDepartment_IDDepartment_Name
<%=company.getInt("ID")%><%=company.getString("NAME")%>
<%=department.getInt("ID")%><%=department.getString("NAME")%>
-<%}%> - - - -
- - diff --git a/java/das/samples/company-webapp/src/main/webapp/META-INF/context.xml b/java/das/samples/company-webapp/src/main/webapp/META-INF/context.xml deleted file mode 100644 index 5f0af32dd5..0000000000 --- a/java/das/samples/company-webapp/src/main/webapp/META-INF/context.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - diff --git a/java/das/samples/company-webapp/src/main/webapp/WEB-INF/web.xml b/java/das/samples/company-webapp/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index a0abb6a655..0000000000 --- a/java/das/samples/company-webapp/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - Tuscany DAS sample Company WEB - - - Company.jsp - - - - - CompanyDBInit - org.apache.tuscany.samples.das.companyweb.CompanyDBInit - 2 - - diff --git a/java/das/samples/customer/build.xml b/java/das/samples/customer/build.xml deleted file mode 100644 index 94ce30e1ca..0000000000 --- a/java/das/samples/customer/build.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/java/das/samples/customer/pom.xml b/java/das/samples/customer/pom.xml deleted file mode 100644 index f8665da523..0000000000 --- a/java/das/samples/customer/pom.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.das.samples - tuscany-das-samples - 1.0-SNAPSHOT - - - tuscany-das-sample-customer - jar - Tuscany DAS Customer Sample - Sample use of RDB DAS in a J2SE application - - - - org.apache.tuscany.das - tuscany-das-rdb - ${das.version} - compile - - - - org.apache.tuscany.sdo - tuscany-sdo-impl - ${sdo.version} - compile - - - - org.apache.tuscany.sdo - tuscany-sdo-api-r2.1 - ${sdo.version} - compile - - - - org.apache.derby - derby - 10.2.2.0 - compile - - - - - - sample-customer - src/main/java - - - src/main/java - - - src/main/resources - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - org.apache.tuscany.samples.das.customer.CustomerClient - true - - - - - - - - - diff --git a/java/das/samples/customer/readme.htm b/java/das/samples/customer/readme.htm deleted file mode 100644 index 0c1f6f715d..0000000000 --- a/java/das/samples/customer/readme.htm +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - -Tuscany DAS Sample - Customer - - - - - -

Customer J2SE sample application

- -
- -

-This stand-alone sample demonstrates the RDB Data Access Service in the context of a simple java application. -

- -
- -

Building and Running

- -
    -
  • Apache Ant latest version installed. -
      -
    • Download Apache Ant latest version on and extract into folder <apache_ant_folder>. You can find it here: http://ant.apache.org/bindownload.cgi.
    • -
    • Add <apache_ant_folder>/bin directory to your OS path variable.

    • -
    -
  • - -
  • On console change the actual directory to <tuscany_das_java_distribution>/samples/customer/ and execute ant application: -
      -
    • <tuscany_das_java_distribution>/samples/customer/> ant
    • -
    -
  • -
- -

-The sample will run and output the following: -

- -

-

-Buildfile: build.xml
-
-run:
-     [java] ************* Initializing database *************
-     [java] ** DB type  : derby
-     [java] ** Database : jdbc:derby:target/dastest; create = true
-     [java] ** User     :
-     [java] ** Password :
-     [java] ************************************************
-     [java] Setting up for derby run!
-     [java] Dropping tables
-     [java] Dropping procedures
-     [java] Creating tables
-     [java] Creating procedures
-     [java] Inserting data in tables
-     [java] Database setup complete!
-     [java]
-     [java] Result:select all customers
-     [java]    ID:1 LASTNAME:John ADDRESS:USA
-     [java]    ID:2 LASTNAME:Amita ADDRESS:INDIA
-     [java]    ID:3 LASTNAME:Patrick ADDRESS:UK
-     [java]    ID:4 LASTNAME:Jane ADDRESS:UN
-     [java]
-     [java] Result:insert new customer
-     [java]    ID:1 LASTNAME:John ADDRESS:USA
-     [java]    ID:2 LASTNAME:Amita ADDRESS:INDIA
-     [java]    ID:3 LASTNAME:Patrick ADDRESS:UK
-     [java]    ID:4 LASTNAME:Jane ADDRESS:UN
-     [java]    ID:5 LASTNAME:Jenny ADDRESS:USA
-     [java]
-     [java] Result:update first customer
-     [java]    ID:1 LASTNAME:BlueBerry ADDRESS:USA
-     [java]    ID:2 LASTNAME:Amita ADDRESS:INDIA
-     [java]    ID:3 LASTNAME:Patrick ADDRESS:UK
-     [java]    ID:4 LASTNAME:Jane ADDRESS:UN
-     [java]    ID:5 LASTNAME:Jenny ADDRESS:USA
-     [java]
-     [java] Result:delete last customer
-     [java] Deleting customer named: Jenny
-     [java]    ID:1 LASTNAME:BlueBerry ADDRESS:USA
-     [java]    ID:2 LASTNAME:Amita ADDRESS:INDIA
-     [java]    ID:3 LASTNAME:Patrick ADDRESS:UK
-     [java]    ID:4 LASTNAME:Jane ADDRESS:UN
-
-BUILD SUCCESSFUL
-
-

- -
- -

-Observation:The build.xml ant file only works on DAS Java binary distribution. -

- - - -

Running Sample with MySQL

-
-

-The sample is pre-configured to run using an embedded Derby database.Follow below instructions to run the sample on another database (e.g MySQL).
-

- -
    -
  • Expand sample-customer.jar under /samples/customer to access CustomersConfig.xml
  • -
  • Change CustomersConfig.xml - comment Derby connection info and uncomment MySQL connection info. Check for correct userName, password, and other configuration information
  • -
  • Change /samples/customer /build.xml to replace pathelement location from Derby jar to MySQL jar like - -
      -
    • <pathelement location="mysql-connector-java-5.0.4.jar"/>
    • -
    -
  • -
  • Create new sample-customer.jar to use the changed CustomersConfig.xml , replacing the one from binary distribution under /samples/customer.
  • -
  • Place required mysql jar (e.g. mysql-connector-java-5.0.4.jar) under /samples/customer.
  • -
  • From command prompt run the sample application using ant - -
      -
    • <tuscany_das_java_distribution>/samples/customer/> ant
    • -
    -
  • -
- -

-Observations: -

    -
  • These instructions apply only for DAS Java binary distribution.
  • -
  • MySQL Database will be created and populated with necessary structure and data if not present
  • -
- - - \ No newline at end of file diff --git a/java/das/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerClient.java b/java/das/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerClient.java deleted file mode 100644 index ca66c5bf4f..0000000000 --- a/java/das/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerClient.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.samples.das.customer; - -import java.io.InputStream; -import java.util.List; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; - -import commonj.sdo.DataObject; - -public class CustomerClient { - private static final String DEFAULT_CUSTOMER_CONFIG = "CustomersConfig.xml"; - - private DAS das = null; - private final String configFile; - - /** - * Default constructor - * - */ - public CustomerClient(){ - this.configFile = DEFAULT_CUSTOMER_CONFIG; - } - - /** - * Constructor receiving the das config file to be used - * @param configFile DAS configuration file - */ - public CustomerClient(String configFile) { - this.configFile = configFile; - } - - /** - * Helper method to get a stream from the customer config file - * @param fileName - * @return - */ - protected InputStream getConfig(String fileName) { - return getClass().getClassLoader().getResourceAsStream(fileName); - } - - /** - * Get a reference to DAS, initialize it if necessary - * @return DAS reference - */ - protected DAS getDAS() { - if (this.das == null ) { - this.das = DAS.FACTORY.createDAS(getConfig(this.configFile)); - } - return this.das; - } - - - /** - * select - * @return - */ - public final List getCustomers() { - Command read = this.getDAS().getCommand("AllCustomers"); - DataObject root = read.executeQuery(); - return root.getList("CUSTOMER"); - } - - /** - * insert - * - */ - public final void addCustomer() { - Command read = this.getDAS().getCommand("AllCustomers"); - DataObject root = read.executeQuery(); - - DataObject newCustomer = root.createDataObject("CUSTOMER"); - newCustomer.setInt("ID", 5); - newCustomer.setString("LASTNAME", "Jenny"); - newCustomer.setString("ADDRESS", "USA"); - - das.applyChanges(root); - } - - /** - * delete - * - */ - public final void deleteCustomer() { - Command readAll = this.getDAS().getCommand("AllCustomers"); - DataObject root = readAll.executeQuery(); - - List allCustomers = root.getList("CUSTOMER"); - - DataObject lastCustomer = (DataObject)allCustomers.get(allCustomers.size()-1); - if(lastCustomer != null){ - System.out.println("Deleting customer named: " + lastCustomer.getString("LASTNAME")); - lastCustomer.delete(); - } - - das.applyChanges(root); - } - - /** - * update - * - */ - public final void changeFirstCustomerName() { - Command readAll = this.getDAS().getCommand("AllCustomers"); - DataObject root = readAll.executeQuery(); - - DataObject firstCustomer = root.getDataObject("CUSTOMER[1]"); - firstCustomer.set("LASTNAME", "BlueBerry"); - - das.applyChanges(root); - } - - /** - * display result - * @param customers - */ - public static void printList(List customers){ - for(int i=0; i0){ - customerConfigFile = args[0]; - } - - - //initialize customer database using helper class - CustomerDatabaseInitializer dbInitializer = new CustomerDatabaseInitializer(customerConfigFile); - try { - dbInitializer.Initialize(); - } catch (Exception e) { - e.printStackTrace(); - return; - } - - - //perform customer operations using DAS - CustomerClient customerClient = new CustomerClient(customerConfigFile); - //test select - System.out.println(); - System.out.println("Result:select all customers"); - printList(customerClient.getCustomers()); - - //test insert - System.out.println(); - System.out.println("Result:insert new customer"); - customerClient.addCustomer(); - printList(customerClient.getCustomers()); - - //test update - System.out.println(); - System.out.println("Result:update first customer"); - customerClient.changeFirstCustomerName(); - printList(customerClient.getCustomers()); - - //test delete - System.out.println(); - System.out.println("Result:delete last customer"); - customerClient.deleteCustomer(); - printList(customerClient.getCustomers()); - } -} \ No newline at end of file diff --git a/java/das/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerDatabaseInitializer.java b/java/das/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerDatabaseInitializer.java deleted file mode 100644 index 260fc330fd..0000000000 --- a/java/das/samples/customer/src/main/java/org/apache/tuscany/samples/das/customer/CustomerDatabaseInitializer.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.samples.das.customer; - -import org.apache.tuscany.das.rdb.config.Config; -import org.apache.tuscany.das.rdb.util.ConfigUtil; -import org.apache.tuscany.samples.das.databaseSetup.DerbySetup; -import org.apache.tuscany.samples.das.databaseSetup.MySQLSetup; - -public class CustomerDatabaseInitializer { - public static final String DERBY = "derby"; - public static final String MYSQL = "mysql"; - - private final Config config; - - private final String dbType; - private final String dbURL; - private final String user; - private final String password; - - - - public CustomerDatabaseInitializer(String configFile) { - this.config = ConfigUtil.loadConfig(this.getClass().getClassLoader().getResourceAsStream(configFile)); - - if(config.getConnectionInfo().getConnectionProperties().getDriverClass().indexOf(DERBY) != -1) { - dbType = DERBY; - } else if(config.getConnectionInfo().getConnectionProperties().getDriverClass().indexOf(MYSQL) != -1) { - dbType = MYSQL; - } else { - dbType = null; - } - - //get connection info from config - dbURL = config.getConnectionInfo().getConnectionProperties().getDatabaseURL(); - user = config.getConnectionInfo().getConnectionProperties().getUserName(); - password = config.getConnectionInfo().getConnectionProperties().getPassword(); - } - - - - /** - * If database is present connect to it and create necessary tables, procedures, data etc. - * If database is not present create database and then create the above elements. Create database - * is implemented for MySQL and Derby. - */ - public void Initialize() { - - //display DB configuration iformation - DisplayDatabaseConfiguration(); - - //initialize DB - try { - if(dbType.equals(DERBY)){ - new DerbySetup(dbURL+"-"+user+"-"+password); - } - - if(dbType.equals(MYSQL)){ - new MySQLSetup(dbURL+"-"+user+"-"+password); - } - - } catch(Exception e){ - throw new RuntimeException("Error initializing database !", e); - } - } - - public void DisplayDatabaseConfiguration() { - - System.out.println("************* Initializing database *************"); - System.out.println("** DB type : " + dbType ); - System.out.println("** Database : " + dbURL ); - System.out.println("** User : " + user ); - System.out.println("** Password : " + password); - System.out.println("************************************************"); - } -} diff --git a/java/das/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetup.java b/java/das/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetup.java deleted file mode 100644 index 4195dbcac7..0000000000 --- a/java/das/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetup.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.samples.das.databaseSetup; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.Properties; -import java.util.StringTokenizer; - -public class DatabaseSetup{ - protected Statement s; - protected String platformName = "Not initialized"; - protected String driverName = "Not initialized"; - protected String databaseURL = "Not initialized"; - protected String databaseName = null; - protected String userName; - protected String password; - - // Data Types - public static final String stringType = "VARCHAR"; - public static final String integerType = "INT"; - public static final String timestampType = "TIMESTAMP"; - public static final String floatType = "FLOAT"; - public static final String decimalType = "DECIMAL"; - protected Connection connection; - - //database types - public static final String DERBY = "derby"; - public static final String MYSQL = "mysql"; - public static final String DB2 = "db2"; - - public DatabaseSetup(String databaseInfo){ - StringTokenizer strTok = new StringTokenizer(databaseInfo, "-"); - - if(strTok.hasMoreTokens()){ - databaseName = strTok.nextToken(); - } - - if(strTok.hasMoreTokens()){ - userName = strTok.nextToken(); - } - - if(strTok.hasMoreTokens()){ - password = strTok.nextToken(); - } - - initConnectionProtocol(databaseName); - initConnection(); - try{ - this.setUp(); - }catch(Exception e){ - e.printStackTrace(); - } - } - - protected void initConnectionProtocol( String databaseName){ - } - - private void initConnection() { - - try { - Class.forName(driverName).newInstance(); - Properties props = new Properties(); - //System.out.println("platform name:"+this.platformName); - - if(this.platformName.equals(DERBY)){ - if (userName != null) { - //System.out.println("derby trying for "+userName+","+password+","+databaseURL); - connection = DriverManager.getConnection(databaseURL, userName, password); - } else { - //System.out.println("derby trying for "+databaseURL); - connection = DriverManager.getConnection(databaseURL); - } - } - if(this.platformName.equals(DB2)){ - if (userName != null && password != null) { - props.put("user", userName); - props.put("password", password); - - //System.out.println("db2 trying for "+databaseURL+"user,pwd"+userName+","+password); - connection = DriverManager.getConnection(databaseURL, props); - }else{ - //System.out.println("db2 trying for "+databaseURL); - connection = DriverManager.getConnection(databaseURL); - } - } - if(this.platformName.equals(MYSQL)){ - databaseURL=databaseURL+"?user="+userName+"&password="+password+"&createDatabaseIfNotExist="+"true"; - //System.out.println("mysql trying for "+userName+","+password+","+databaseURL); - connection = DriverManager.getConnection(databaseURL, props); - } - - connection.setAutoCommit(true); - } catch (SQLException e) { - e.printStackTrace(); - if (e.getNextException() != null) { - e.getNextException().printStackTrace(); - } else { - e.printStackTrace(); - } - - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - e.printStackTrace(); - throw new RuntimeException(e); - } catch (InstantiationException e) { - e.printStackTrace(); - throw new RuntimeException(e); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - } - - public Connection getConnection(){ - return this.connection; - } - - protected void setUp() throws Exception { - System.out.println("Setting up for " + platformName + " run!"); - } - - private void insertData(){ - } - - private void dropTables() { - } - - protected void dropTriggers() { - } - - protected void createTriggers() { - } - - protected void dropSequences() { - } - - protected void createSequences() { - } - - protected void dropProcedures() { - } - - private void createTables() { - } - - protected void createProcedures() { - } - - // - // This section povides methods that return strings for table creation. - // Platform-specific sublcasses - // can override these as necessary - // - - protected String getCreateCustomer() { - return null; - } - // ///////////////// - - protected String getForeignKeyConstraint(String pkTable, String pkColumn, String foreignKey) { - return null; - } - - protected String getStringColumn(String name, int length) { - return null; - } - - protected String getIntegerColumn(String name) { - return null; - } - - protected String getGeneratedKeyClause() { - return null; - } - - protected String getDecimalColumn(String name, int size1, int size2) { - return null; - } - - protected String getFloatColumn(String name) { - return null; - } - - protected String getTimestampColumn(String name) { - return null; - } -} \ No newline at end of file diff --git a/java/das/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DerbySetup.java b/java/das/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DerbySetup.java deleted file mode 100644 index 339cac3587..0000000000 --- a/java/das/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DerbySetup.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.samples.das.databaseSetup; - -import java.sql.SQLException; - -public class DerbySetup extends DatabaseSetup { - - public DerbySetup(String databaseInfo){ - super(databaseInfo); - } - - protected void initConnectionProtocol(String databaseURL){ - this.platformName=DERBY; - this.driverName = "org.apache.derby.jdbc.EmbeddedDriver"; - this.databaseURL = databaseURL; - } - - public void setUp(){ - try{ - super.setUp(); - - try { - s = connection.createStatement(); - - dropTriggers(); - dropSequences(); - dropTables(); - dropProcedures(); - - createSequences(); - createTables(); - createTriggers(); - createProcedures(); - connection.commit(); - - insertData(); - connection.commit(); - } catch (SQLException e) { - connection.rollback(); - } - }catch(Exception e){ - e.printStackTrace(); - } - - System.out.println("Database setup complete!"); - } - - private void insertData(){ - System.out.println("Inserting data in tables"); - - String[] statements = {"INSERT INTO CUSTOMER VALUES (1,'John','USA')", - "INSERT INTO CUSTOMER VALUES (2,'Amita','INDIA')", - "INSERT INTO CUSTOMER VALUES (3,'Patrick','UK')", - "INSERT INTO CUSTOMER VALUES (4,'Jane','UN')"}; - - 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().indexOf("does not exist") >= 0)) && (!(e.getMessage().indexOf("Unknown table") >= 0)) - && (!(e.getMessage().indexOf("42704") >= 0))) { - throw new RuntimeException(e); - } - } - } - } - - private void dropTables() { - System.out.println("Dropping tables"); - String[] statements = {"DROP TABLE CUSTOMER" }; - - 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().indexOf("does not exist") >= 0)) && (!(e.getMessage().indexOf("Unknown table") >= 0)) - && (!(e.getMessage().indexOf("42704") >= 0))) { - throw new RuntimeException(e); - } - } - } - } - - protected void dropTriggers() { - - } - - protected void createTriggers() { - - } - - protected void dropSequences() { - - } - - protected void createSequences() { - - } - - protected void dropProcedures() { - - System.out.println("Dropping procedures"); - - String[] statements = {"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().indexOf("does not exist") >= 0) && !(e.getMessage().indexOf("42704") >= 0)) { - throw new RuntimeException(e); - } - } - } - } - - private void createTables() { - System.out.println("Creating tables"); - - try { - s.execute(getCreateCustomer()); - } catch (SQLException e) { - throw new RuntimeException(e); - } - } - - protected void createProcedures() { - - System.out.println("Creating procedures"); - try { - - 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.samples.das.orders.MyStoredProcs.getNamedCustomers'"); - } catch (SQLException e) { - e.printStackTrace(); - 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 (" + getIntegerColumn("ID") + " PRIMARY KEY NOT NULL, " - + getStringColumn("LASTNAME", 30) - + " DEFAULT 'Garfugengheist', " + getStringColumn("ADDRESS", 30) + ")"; - } - - protected String getForeignKeyConstraint(String pkTable, String pkColumn, String foreignKey) { - StringBuffer buffer = new StringBuffer(); - buffer.append("CONSTRAINT FK1 FOREIGN KEY ("); - buffer.append(foreignKey); - buffer.append(") REFERENCES "); - buffer.append(pkTable); - buffer.append("("); - buffer.append(pkColumn); - buffer.append(") ON DELETE NO ACTION ON UPDATE NO ACTION"); - return buffer.toString(); - } - - protected String getStringColumn(String name, int length) { - return name + ' ' + stringType + "(" + new Integer(length).toString() + ")"; - } - - protected String getIntegerColumn(String name) { - return name + ' ' + integerType; - } - - protected String getGeneratedKeyClause() { - return "GENERATED ALWAYS AS IDENTITY"; - } - - protected String getDecimalColumn(String name, int size1, int size2) { - return name + ' ' + decimalType + "(" + new Integer(size1).toString() + ',' - + new Integer(size2).toString() + ")"; - } - - protected String getFloatColumn(String name) { - return name + ' ' + floatType; - } - - protected String getTimestampColumn(String name) { - return name + ' ' + timestampType; - } -} diff --git a/java/das/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/MySQLSetup.java b/java/das/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/MySQLSetup.java deleted file mode 100644 index f64b16e2db..0000000000 --- a/java/das/samples/customer/src/main/java/org/apache/tuscany/samples/das/databaseSetup/MySQLSetup.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.samples.das.databaseSetup; - -import java.sql.SQLException; - -public class MySQLSetup extends DatabaseSetup { - - public MySQLSetup(String databaseInfo){ - super(databaseInfo); - } - - protected void initConnectionProtocol(String databaseURL){ - this.platformName=MYSQL; - this.driverName = "com.mysql.jdbc.Driver"; - this.databaseURL = databaseURL; - } - - public void setUp(){ - try{ - super.setUp(); - - try { - s = connection.createStatement(); - - dropTriggers(); - dropSequences(); - dropTables(); - dropProcedures(); - - createSequences(); - createTables(); - createTriggers(); - createProcedures(); - insertData(); - } catch (SQLException e) { - e.printStackTrace(); - } - }catch(Exception e){ - e.printStackTrace(); - } - - System.out.println("Database setup complete!"); - } - - private void insertData(){ - System.out.println("Inserting data in tables"); - - String[] statements = {"INSERT INTO CUSTOMER VALUES (1,'John','USA')", - "INSERT INTO CUSTOMER VALUES (2,'Amita','INDIA')", - "INSERT INTO CUSTOMER VALUES (3,'Patrick','UK')", - "INSERT INTO CUSTOMER VALUES (4,'Jane','UN')"}; - - 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().indexOf("does not exist") >= 0)) && (!(e.getMessage().indexOf("Unknown table") >= 0)) - && (!(e.getMessage().indexOf("42704") >= 0))) { - throw new RuntimeException(e); - } - } - } - } - - private void dropTables() { - System.out.println("Dropping tables"); - - String[] statements = {"DROP TABLE CUSTOMER"}; - - 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().indexOf("does not exist") >= 0)) && (!(e.getMessage().indexOf("Unknown table") >= 0)) - && (!(e.getMessage().indexOf("42704") >= 0))) { - throw new RuntimeException(e); - } - } - } - } - - protected void dropTriggers() { - - } - - protected void createTriggers() { - - } - - protected void dropSequences() { - - } - - protected void createSequences() { - - } - - protected void dropProcedures() { - - System.out.println("Dropping procedures"); - - String[] statements = {"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().indexOf("does not exist") >= 0) && !(e.getMessage().indexOf("42704") >= 0)) { - throw new RuntimeException(e); - } - } - } - } - - private void createTables() { - System.out.println("Creating tables"); - - try { - - s.execute(getCreateCustomer()); - - } 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 (" + getIntegerColumn("ID") + " PRIMARY KEY NOT NULL, " - + getStringColumn("LASTNAME", 30) - + " DEFAULT 'Garfugengheist', " + getStringColumn("ADDRESS", 30) + ")"; - } - - // ///////////////// - - protected String getForeignKeyConstraint(String pkTable, String pkColumn, String foreignKey) { - StringBuffer buffer = new StringBuffer(); - buffer.append("CONSTRAINT FK1 FOREIGN KEY ("); - buffer.append(foreignKey); - buffer.append(") REFERENCES "); - buffer.append(pkTable); - buffer.append("("); - buffer.append(pkColumn); - buffer.append(") ON DELETE NO ACTION ON UPDATE NO ACTION"); - return buffer.toString(); - } - - protected String getStringColumn(String name, int length) { - return name + ' ' + stringType + "(" + new Integer(length).toString() + ")"; - } - - protected String getIntegerColumn(String name) { - return name + ' ' + integerType; - } - - protected String getDecimalColumn(String name, int size1, int size2) { - return name + ' ' + decimalType + "(" + new Integer(size1).toString() + ',' - + new Integer(size2).toString() + ")"; - } - - protected String getFloatColumn(String name) { - return name + ' ' + floatType; - } - - protected String getTimestampColumn(String name) { - return name + ' ' + timestampType; - } - - protected void createProcedures() { - 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 "; - - System.out.println("Creating procedures"); - try { - s.execute(createGetNamedCustomers); - } catch (SQLException e) { - throw new RuntimeException(e); - } - } - - protected String getGeneratedKeyClause() { - return "AUTO_INCREMENT"; - } -} diff --git a/java/das/samples/customer/src/main/resources/CustomersConfig.xml b/java/das/samples/customer/src/main/resources/CustomersConfig.xml deleted file mode 100644 index 41fa03ba2b..0000000000 --- a/java/das/samples/customer/src/main/resources/CustomersConfig.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - -
- - - - - - -
diff --git a/java/das/samples/customer/src/main/resources/META-INF/LICENSE b/java/das/samples/customer/src/main/resources/META-INF/LICENSE deleted file mode 100644 index fb4df3722c..0000000000 --- a/java/das/samples/customer/src/main/resources/META-INF/LICENSE +++ /dev/null @@ -1,353 +0,0 @@ - - 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. - -=============================================================================================================== - -Other components and dependencies under Apache Software License 2.0 : - - log4j-1.2.14.jar - Apache Logging Services - derby 10.2.2.0.jar - Apache Derby - stax-api-1.0.1.jar - The Streaming API for XML (StAX) - wstx-asl-3.2.0.jar - WoodStox StAX implementation - standard-1.1.1.jar - The Apache Jackarta Taglibs - jstl-1.1.2.jar - The Apache Jackarta Taglibs - *.tld - The Apache Jackarta Taglibs - -=============================================================================================================== - - -Apache Tuscany SDO for Java Subcomponents -=========================================: - -The Tuscany SDO for Java release 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. - -License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar) - -Permission to copy, make derivative works of, and distribute the Service Data Objects -JavaDoc and Interface Definition Files files in any medium without fee or royalty as part -of a compliant implementation of the Service Data Objects Specification is hereby granted. -The Service Data Objects Specification may be found at any of the following locations: - -http://dev2dev.bea.com/technologies/commonj/index.jsp -http://www.ibm.com/developerworks/library/specification/ws-sdo/ -http://oracle.com/technology/webservices/sca -https://www.sdn.sap.com/ -http://www.xcalia/xdn/specs/sdo - -THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES -ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS -SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS, -INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, -NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE -SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES. - -The name and trademarks of the Authors may NOT be used in any manner, including advertising or -publicity pertaining to the Service Component Architecture Specification or its contents without specific, -written prior permission. Title to copyright in the Service Data Objects Specification and the -JavaDoc and Interface Definition Files will at all times remain with the Authors. - -No other rights are granted by implication, estoppel or otherwise. - -================================================================================================================= - -For the Eclipse EMF components -(codegen-2.2.3.jar -codegen-ecore-2.2.3.jar -common-2.2.3.jar -ecore-2.2.3.jar -ecore-change-2.2.3.jar -ecore-xmi-2.2.3.jar -xsd-2.2.3.jar) - -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. - -=================================================================================================== diff --git a/java/das/samples/customer/src/main/resources/META-INF/NOTICE b/java/das/samples/customer/src/main/resources/META-INF/NOTICE deleted file mode 100644 index c2cf1f95b4..0000000000 --- a/java/das/samples/customer/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,32 +0,0 @@ -Apache Tuscany SDO for Java -Copyright 2006, 2007 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - -Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF), -sponsored by the Apache 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. - -Unless otherwise indicated, all distribution made available by the Apache Software Foundation -is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL"). -A copy of the AL is provided with this distribution as the LICENSE.txt file present in the -root directory, and is also available at http://www.apache.org/licenses/. - -The terms and conditions governing the distribution may refer to the AL or other license -agreements, notices or terms and conditions. Some of these other license agreements may -include (but are not limited to): - - . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html) - -It is your obligation to read and accept all such terms and conditions prior to use of the -distribution. If term or condition is provided, please contact the Apache Software Foundation -to determine what terms and conditions govern that particular distribution. - -This product also includes software developed by the Open Service Oriented Architecture organisation -(http://osoa.org). The license for this software may be found in the LICENSE.txt file contained in this -distribution. diff --git a/java/das/samples/customer/src/main/resources/META-INF/README b/java/das/samples/customer/src/main/resources/META-INF/README deleted file mode 100644 index d1905ee3e8..0000000000 --- a/java/das/samples/customer/src/main/resources/META-INF/README +++ /dev/null @@ -1,35 +0,0 @@ -Apache Tuscany M2 build (October, 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/java/das/samples/customer/src/main/resources/log4j.properties b/java/das/samples/customer/src/main/resources/log4j.properties deleted file mode 100644 index ab4ebbb785..0000000000 --- a/java/das/samples/customer/src/main/resources/log4j.properties +++ /dev/null @@ -1,36 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=INFO, NULL - -# NULL Appender -log4j.appender.NULL=org.apache.log4j.varia.NullAppender - -log4j.appender.NULL.layout=org.apache.log4j.PatternLayout -log4j.appender.NULL.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n - -# CONSOLE is set to be a ConsoleAppender. -log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout -log4j.appender.CONSOLE.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n - - -# Print only messages of level WARN or above in the package com.foo. -log4j.logger.org.apache.tuscany=NONE \ No newline at end of file diff --git a/java/das/samples/dbconfig/pom.xml b/java/das/samples/dbconfig/pom.xml deleted file mode 100644 index 372bcbc302..0000000000 --- a/java/das/samples/dbconfig/pom.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.das.samples - tuscany-das-samples - 1.0-SNAPSHOT - - - tuscany-das-sample-dbconfig - jar - Tuscany DAS Canned DB Initializer Utility - - - - org.apache.tuscany.das - tuscany-das-rdb - ${das.version} - compile - - - - org.apache.tuscany.sdo - tuscany-sdo-impl - ${sdo.version} - compile - - - - org.apache.tuscany.sdo - tuscany-sdo-api-r2.1 - ${sdo.version} - compile - - - - org.apache.derby - derby - 10.2.2.0 - compile - - - - log4j - log4j - 1.2.14 - compile - - - - junit - junit - 3.8.1 - test - - - - - - sample-dbconfig - src/main/java - - - src/main/java - - - src/main/resources - - - - - - org.apache.tuscany.sdo - tuscany-sdo-plugin - ${sdo.version} - - - config - - ${basedir}/src/main/resources/DBConfig.xsd - true - true - - - generate - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - **/*TestCase.java - - - - - - - - - diff --git a/java/das/samples/dbconfig/readme.html b/java/das/samples/dbconfig/readme.html deleted file mode 100644 index da8c83a824..0000000000 --- a/java/das/samples/dbconfig/readme.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - -Tuscany RDB DAS Database Setup Utility - - - - - -

Tuscany RDB DAS Database Setup Utility

- -
- -

This utility provides a jar file to be used by RDB DAS sample -applications (web or standalone) to do database setup. So far the -samples provided canned pre-created Derby database with tables and data. -There was no convenient way to refresh table data during the samples -execution. This utility supports Derby database at present and uses a -config file to get the setup information.

- -

APIs

- -
    -public DBInitializer() – uses default provided ConfigFile CannedSampleDBConfig.xml
    -public DBInitializer(String ConfigFileLocation)
    -public DBInitializer (InputStream ConfigFileStream)
    -public void initializeDatabase(boolean clean) - Create database tables and fill data. If clean=true, all tables will be dropped and recreated.
    -public void initializeDatabaseData(boolean clean) - create database data (with clean=true, if a table has pre-existing data, it will be deleted first)
    -public void refreshDatabaseData() – calls initializeDatabase(clean=true)
    -public boolean isDatabaseReady() - will return true, if the tables exist in the database
    -public boolean isDatabasePopulated() - will return true, if the tables have data
    -
- -

Assumptions:

-

<table> element lists tables in proper sequence, i.e. parent tables -first and then child tables. This sequence will be used in -create,insert,delete,drop to take care of referential integrity. The -config file required by utility supports the following features through -different attributes and elements. Sample xml file is shown at the end. - -

- -

<ConnectionInfo>

-

This element provides connection specific information - like vendor -specific database URL, user name, password etc. If the DataSource is -provided by the web container, user needs to only fill dataSource -attribute in this. In case of standalone J2SE samples, user needs to -fill ConnectionProperties element inside ConnectionInfo. These two ways -of connection specification are mutually exclusive.

- -

<table>

-

This element needs to specify the table names required by the -sample. Only these tables will be considered for creation, data -population. This gives flexibility to the user to choose the required -set of tables based on the sample's requirement. It also needs to -specify in the attributes, the Create SQL command used to create this -table.<table> has sequence element <row> which is used to provide -the data to be populated in the table. -

- -

Set Up

- -

To use this utility, include its jar and required database - driver's jar in the classpath. Provide the config file used by this - utility , similar to the example below, in the source folder of the - sample.
-

- -

DBConfig.xml example

- -
    - <?xml version="1.0" encoding="ASCII"?>
    - <!-- Licensed to the Apache Software Foundation (ASF) under one or - more contributor license agreements. See the NOTICE file distributed - with this work for additional information regarding copyright - ownership. The ASF licenses this file to you 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. -->

    - <DBConfig - xmlns="http:///org.apache.tuscany.das.rdb/dbconfig.xsd">

    - <ConnectionInfo>
    - <ConnectionProperties - driverClass="org.apache.derby.jdbc.EmbeddedDriver" - databaseURL="jdbc:derby:target/dastest; create = true" - loginTimeout="600000" />
    - </ConnectionInfo>

    - <Table - name="COMPANY" SQLCreate="CREATE TABLE COMPANY (ID INT PRIMARY KEY NOT - NULL, NAME VARCHAR(30), EOTMID INTEGER)">
    - <row> 51, 'ACME Publishing', 0 </row>
    - <row> 52, 'Do-rite plumbing', 0 </row>
    - <row> 53, 'MegaCorp', 0 </row>
    - </Table>

    - <Table name="DEPARTMENT" SQLCreate="CREATE TABLE DEPARTMENT (ID INT - PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY, NAME - VARCHAR(30),LOCATION VARCHAR(30), DEPNUMBER VARCHAR(10),COMPANYID - INT)">
    - <row> 'Advanced Technologies', 'NY', '123', 1 </row>
    - <row> 'Default Name', '', '', 51 </row>
    - <row> 'Default Name', '', '', 51 </row>
    - <row> 'Default Name', '', '', 51 </row>
    - <row> 'Default Name', '', '', 51 </row>
    - <row> 'Default Name', '', '', 51 </row>
    - <row> 'Default Name', '', '', 51 </row>
    - </Table>

    - - <Table name="EMPLOYEE" SQLCreate="CREATE TABLE EMPLOYEE (ID INT - PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY,NAME VARCHAR(30),SN - VARCHAR(10), MANAGER SMALLINT, DEPARTMENTID INT)">
    - <row> 'John Jones','E0001',0,12 </row>
    - <row> 'Mary Smith','E0002',1,null </row>
    - <row> 'Jane Doe','E0003',0,12 </row>
    - <row> 'Al Smith','E0004',1,12 </row>
    - </Table>

    </DBConfig>
    - -
- - - - diff --git a/java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConfigUtil.java b/java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConfigUtil.java deleted file mode 100644 index 783f822bc4..0000000000 --- a/java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConfigUtil.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.dbconfig; - - -import java.io.IOException; -import java.io.InputStream; - -import commonj.sdo.helper.HelperContext; -import commonj.sdo.helper.XMLHelper; -import commonj.sdo.impl.HelperProvider; - -/** - * Config util provides config-related utilities such as loading a Config - * instance from an InputStream - * - */ -public final class DBConfigUtil { - - private DBConfigUtil() { - } - - public static DBConfig loadDBConfig(InputStream dbconfigStream) { - - if (dbconfigStream == null) { - throw new RuntimeException("Cannot load configuration from a null InputStream. " - + "Possibly caused by an incorrect config xml file name"); - } - - HelperContext context = HelperProvider.getDefaultContext(); - DbconfigFactory.INSTANCE.register(context); - XMLHelper helper = context.getXMLHelper(); - - try { - return (DBConfig) helper.load(dbconfigStream).getRootObject(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - -} diff --git a/java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConnectionHelper.java b/java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConnectionHelper.java deleted file mode 100644 index 5f64145c58..0000000000 --- a/java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBConnectionHelper.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.dbconfig; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; - -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.sql.DataSource; - -import org.apache.log4j.Level; -import org.apache.log4j.Logger; - -public class DBConnectionHelper { - private static final Logger logger = Logger.getLogger(DBConnectionHelper.class); - - protected DBConnectionHelper(){ - if(logger.isDebugEnabled()) { - logger.log(Level.DEBUG, "DBConnectionHelper()"); - } - } - - /** - * Basic validation of Config for connection information and call to - * connection helper to establish database connection. Connection using - * DriverManager or DataSource are supported. - * - */ - public static Connection createConnection(ConnectionInfo connectionInfo) { - if (logger.isDebugEnabled()) { - logger.log(Level.DEBUG, "DBConnectionHelper.createConnection(ConnectionInfo)"); - } - - if (connectionInfo == null || - (connectionInfo.getDataSource() == null && - (connectionInfo.getConnectionProperties() == null || connectionInfo.getConnectionProperties().getDatabaseURL() == null - || connectionInfo.getConnectionProperties().getDriverClass() == null)) ) { - throw new RuntimeException("No connection has been provided and no data source has been specified"); - } - - if(connectionInfo.getDataSource() != null && - (connectionInfo.getConnectionProperties() != null && connectionInfo.getConnectionProperties().getDatabaseURL() != null) ){ - throw new RuntimeException("Use either dataSource or databaseURL. Can't use both !"); - } - - Connection connection = null; - - if(connectionInfo.getDataSource() != null){ - connection = initializeDatasourceConnection(connectionInfo); - }else{ - connection = initializeDriverManagerConnection(connectionInfo); - } - - return connection; - - } - /** - * Initializes a DB connection on a managed environmet (e.g inside Tomcat) - */ - private static Connection initializeDatasourceConnection(ConnectionInfo connectionInfo){ - if (logger.isDebugEnabled()) { - logger.log(Level.DEBUG, "DBConnectionHelper.initializeDatasourceConnection(ConnectionInfo)"); - } - - InitialContext ctx; - Connection connection; - - try { - ctx = new InitialContext(); - } catch (NamingException e) { - throw new RuntimeException(e); - } - try { - DataSource ds = (DataSource) ctx.lookup(connectionInfo.getDataSource()); - try { - try { - if(connectionInfo.getConnectionProperties() != null && - connectionInfo.getConnectionProperties().getUserName() != null && - connectionInfo.getConnectionProperties().getPassword() != null ) { - connection = ds.getConnection(connectionInfo.getConnectionProperties().getUserName(), connectionInfo.getConnectionProperties().getPassword()); - } else { - connection = ds.getConnection(); - } - }catch(Exception e) { - connection = ds.getConnection(); - } - - if (connection == null) { - throw new RuntimeException("Could not obtain a Connection from DataSource"); - } - connection.setAutoCommit(true); - - } catch (SQLException e) { - throw new RuntimeException(e); - } - } catch (NamingException e) { - throw new RuntimeException(e); - } - - if( logger.isDebugEnabled()) { - logger.log(Level.DEBUG, "DBConnectionHelper.initializeDatasourceConnection() exit"); - } - return connection; - } - - /** - * Initialize a DB connection on a J2SE environment - * For more info, see http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/drivermanager.html - */ - private static Connection initializeDriverManagerConnection(ConnectionInfo connectionInfo) { - if (logger.isDebugEnabled()) { - logger.log(Level.DEBUG, "DBConnectionHelper.initializeDriverManagerConnection(ConnectionInfo)"); - } - - if (connectionInfo.getConnectionProperties() == null) { - throw new DataSourceInitializationException("No existing context and no connection properties"); - } - - if (connectionInfo.getConnectionProperties().getDriverClass() == null) { - throw new DataSourceInitializationException("No jdbc driver class specified!"); - } - - Connection connection; - - try { - //initialize driver and register it with DriverManager - Class.forName(connectionInfo.getConnectionProperties().getDriverClass()); - - //prepare to initialize connection - String databaseUrl = connectionInfo.getConnectionProperties().getDatabaseURL(); - String userName = connectionInfo.getConnectionProperties().getUserName(); - String userPassword = connectionInfo.getConnectionProperties().getPassword(); - int loginTimeout = connectionInfo.getConnectionProperties().getLoginTimeout(); - - DriverManager.setLoginTimeout(loginTimeout); - if( (userName == null || userName.length() ==0) && (userPassword == null || userPassword.length()==0) ){ - //no username or password suplied - connection = DriverManager.getConnection(databaseUrl); - }else{ - connection = DriverManager.getConnection(databaseUrl, userName, userPassword); - } - - if(connection == null){ - throw new DataSourceInitializationException("Error initializing connection : null"); - } - - connection.setAutoCommit(true); - }catch(ClassNotFoundException cnf){ - throw new DataSourceInitializationException("JDBC Driver '" + connectionInfo.getConnectionProperties().getDriverClass() + "' not found", cnf); - }catch(SQLException sqle){ - throw new DataSourceInitializationException(sqle.getMessage(), sqle); - } - - if (logger.isDebugEnabled()) { - logger.log(Level.DEBUG, "DBConnectionHelper.initializeDriverManagerConnection() exit"); - } - - return connection; - } -} diff --git a/java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBDataHelper.java b/java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBDataHelper.java deleted file mode 100644 index 2ef25bdf81..0000000000 --- a/java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBDataHelper.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.dbconfig; - -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.Iterator; -import java.util.List; - -import org.apache.log4j.Level; -import org.apache.log4j.Logger; - -public class DBDataHelper { - private static final String CLASS_NAME = "DBDataHelper"; - - private final Logger logger = Logger.getLogger(DBDataHelper.class); - - private final DBConfig dbConfig; - - protected DBDataHelper(DBConfig dbConfig) { - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, "DBDataHelper()"); - } - - this.dbConfig = dbConfig; - } - - public boolean isDatabasePopulated() { - boolean isPopulated = true; - - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, CLASS_NAME + ".isDatabasePopulated()"); - } - - Iterator tableIterator = dbConfig.getTable().iterator(); - while (tableIterator.hasNext()) { - Table table = (Table) tableIterator.next(); - - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, CLASS_NAME + ".isDatabasePopulated() calling isTablePopulated() for '" + table.getName() + "'"); - } - - isPopulated = this.isTablePopulated(table.getName()); - if (isPopulated == false) { - break; - } - } - return isPopulated; - } - - /** - * - * @param tableName - * @return Count of rows present in the table specified by tableName - */ - protected boolean isTablePopulated(String tableName) { - boolean isPopulated = false; - Connection dbConnection = null; - Statement dbStatement = null; - - try { - dbConnection = DBConnectionHelper.createConnection(dbConfig.getConnectionInfo()); - dbStatement = dbConnection.createStatement(); - String sqlString = "select count(*) from " + tableName; - - this.logger.log(Level.DEBUG, CLASS_NAME + ".isTablePopulated()=> sqlString => '" + sqlString + "'"); - - ResultSet rs = dbStatement.executeQuery(sqlString); - rs.next(); - - if (rs != null) { - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, CLASS_NAME + ".isTablePopulated()=> pointer set"); - } - } - - int count = rs.getInt(1); - - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, CLASS_NAME + ".isTablePopulated()=> '" + tableName + "' => " + count); - } - - if (count > 0) { - isPopulated = true; - } - - } catch (SQLException e) { - // ignore and return false - } finally { - try { - dbStatement.close(); - dbConnection.close(); - } catch (SQLException e1) { - // ignore and return false - } - } - - return isPopulated; - } - - protected String generateInsertSQL(Connection dbConnection, String tableName, String rowValues) throws SQLException { - StringBuffer sqlBuffer = new StringBuffer(50); - - Statement dbStatement = dbConnection.createStatement(); - ResultSet dummyRS = dbStatement.executeQuery("SELECT * FROM "+tableName); - ResultSetMetaData rsMetaData = dummyRS.getMetaData(); - - - sqlBuffer.append("INSERT INTO ").append(tableName).append(" ("); - - int numberOfColumns = rsMetaData.getColumnCount(); - String columnName = null; - int i; - for (i = 1; i <= numberOfColumns -1; i++) { - //get the column's name. - columnName = rsMetaData.getColumnName(i); - if(!rsMetaData.isAutoIncrement(i)){ - sqlBuffer.append(columnName).append(","); - } - else{ - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, CLASS_NAME + ".initializeDatabaseData()=> auto increment column => " + i + " "+columnName); - } - } - } - sqlBuffer.append(rsMetaData.getColumnName(i)).append(") "); - sqlBuffer.append("VALUES (").append(rowValues).append(")"); - - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, CLASS_NAME + ".initializeDatabaseData()=> SQL Clause => " + sqlBuffer); - } - - return sqlBuffer.toString(); - } - - public void initializeDatabaseData() { - Connection dbConnection = null; - Statement dbStatement = null; - - try { - dbConnection = DBConnectionHelper.createConnection(dbConfig.getConnectionInfo()); - dbStatement = dbConnection.createStatement(); - - Iterator tableIterator = dbConfig.getTable().iterator(); - while (tableIterator.hasNext()) { - Table table = (Table) tableIterator.next(); - - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, CLASS_NAME + ".initializeDatabaseData()=> INSERT FOR TABLE => '" + table.getName() + "'"); - } - - //String columnClause = generateInsertSQL(dbConnection, table.getName()); - - String tableName = table.getName(); - Iterator dataIterator = table.getRow().iterator(); - while (dataIterator.hasNext()) { - String tableRow = (String) dataIterator.next(); - String sqlString = generateInsertSQL(dbConnection, tableName, tableRow); - - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, CLASS_NAME + ".initializeDatabaseData()=> sqlString => '" + sqlString + "'"); - } - - try { - dbStatement.executeUpdate(sqlString); - }catch(SQLException e){ - //e.printStackTrace(); - //ignore and jump to new table - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, CLASS_NAME + ".initializeDatabaseData() - Error inserting table data : " + e.getMessage(), e); - } - } - } - } - } catch (SQLException e) { - // ignore and return false - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, CLASS_NAME + ".initializeDatabaseData() - Internal error : " + e.getMessage(), e); - } - } finally { - try { - dbStatement.close(); - dbConnection.close(); - } catch (SQLException e1) { - // ignore and return false - } - } - } - - public void deleteDatabaseData() { - Connection dbConnection = null; - Statement dbStatement = null; - - try { - dbConnection = DBConnectionHelper.createConnection(dbConfig.getConnectionInfo()); - dbStatement = dbConnection.createStatement(); - //inverse order - to take care of parent-child - List tables = dbConfig.getTable(); - for(int i=tables.size()-1; i>-1; i-- ){ - Table table = (Table) tables.get(i); - String sqlString = "DELETE FROM " + table.getName() ; - - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, CLASS_NAME + ".deleteDatabaseData()=> sqlString => '" + sqlString + "'"); - } - - try { - dbStatement.executeQuery(sqlString); - }catch(SQLException e){ - e.printStackTrace(); - //ignore and jump to new table - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, CLASS_NAME + ".deleteDatabaseData() - Error inserting table data : " + e.getMessage(), e); - } - } - } - } catch (SQLException e) { - // ignore and return false - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, CLASS_NAME + ".initializeDatabaseData() - Internal error : " + e.getMessage(), e); - } - } finally { - try { - dbStatement.close(); - dbConnection.close(); - } catch (SQLException e1) { - // ignore and return false - } - } - } -} diff --git a/java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBHelper.java b/java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBHelper.java deleted file mode 100644 index 028ec59d63..0000000000 --- a/java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBHelper.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.dbconfig; - -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.Iterator; - -import org.apache.log4j.Level; -import org.apache.log4j.Logger; - -public class DBHelper { - private static final String CLASS_NAME = "DBHelper"; - - private final Logger logger = Logger.getLogger(DBHelper.class); - - private final DBConfig dbConfig; - - /** - * Constructor - * - * @param DBConfig - */ - protected DBHelper(DBConfig dbConfig) { - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, CLASS_NAME + "()"); - } - this.dbConfig = dbConfig; - } - - /** - * Check if tables specified in Config exist - * - * @return true if all specified tables exist, false otherwise - */ - protected boolean isDatabaseReady() { - boolean bResult = true; - - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, CLASS_NAME + "isDatabaseReady()"); - } - - Connection dbConnection = null; - DatabaseMetaData dbMetaData = null; - try { - dbConnection = DBConnectionHelper.createConnection(dbConfig.getConnectionInfo()); - dbMetaData = dbConnection.getMetaData(); - - if (dbConfig.getTable() != null && dbConfig.getTable().size() > 0) { - Iterator tableIterator = dbConfig.getTable().iterator(); - while (tableIterator.hasNext()) { - Table table = (Table) tableIterator.next(); - - if (!dbMetaData.getTables(null, null, table.getName(), null).next()) { - bResult = false; - } - - } - } - } catch (SQLException e) { - bResult = false; - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, "Error retrieving database metadata", e); - } - } finally { - try { - if(dbConnection != null) dbConnection.close(); - } catch (SQLException e) { - // ignore here - } - } - - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, CLASS_NAME + "isDatabaseReady() exit"); - } - - return bResult; - } - - /** - * Create the database tables based on dbConfig definition - */ - protected void initializeDatabase() { - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, CLASS_NAME + "initializeDatabase()"); - } - - Connection dbConnection = null; - Statement dbStatement = null; - try { - dbConnection = DBConnectionHelper.createConnection(dbConfig.getConnectionInfo()); - dbStatement = dbConnection.createStatement(); - - if (dbConfig.getTable() != null && dbConfig.getTable().size() > 0) { - Iterator tableIterator = dbConfig.getTable().iterator(); - while (tableIterator.hasNext()) { - Table table = (Table) tableIterator.next(); - - if (table.getSQLCreate() != null && table.getSQLCreate().length() > 0) { - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, "Creating table '" + table.getName() + "' => " + table.getSQLCreate()); - } - - dbStatement.execute(table.getSQLCreate()); - } - } - } - } catch (SQLException e) { - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, "Error retrieving database metadata", e); - } - } finally { - try { - dbStatement.close(); - dbConnection.close(); - } catch (SQLException e) { - // ignore here - } - } - - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, CLASS_NAME + "initializeDatabase() exit"); - } - } - - /** - * Drop the database tables based on dbConfig definition - */ - protected void dropDatabaseTables() { - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, CLASS_NAME + "dropDatabaseTables()"); - } - - Connection dbConnection = null; - Statement dbStatement = null; - try { - dbConnection = DBConnectionHelper.createConnection(dbConfig.getConnectionInfo()); - dbStatement = dbConnection.createStatement(); - - if (dbConnection != null && dbStatement != null && dbConfig.getTable() != null && dbConfig.getTable().size() > 0) { - //reverse order to take care of dropping child tables before parent tables. - for(int i=dbConfig.getTable().size()-1; i>-1; i--) { - Table table = (Table) dbConfig.getTable().get(i); - - if (table.getSQLCreate() != null && table.getSQLCreate().length() > 0) { - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, "Dropping table '" + table.getName() ); - } - - try { - dbStatement.execute("DROP TABLE " + table.getName()); - } catch (SQLException e) { - //ignore - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, "Error droping table '" + table.getName() + "'", e); - } - } - } - } - } - } catch (SQLException e) { - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, "Error droping table", e); - } - } finally { - try { - if(dbStatement != null) - dbStatement.close(); - - if(dbConnection != null) - dbConnection.close(); - } catch (SQLException e) { - // ignore here - } - } - - if (logger.isDebugEnabled()) { - this.logger.log(Level.DEBUG, CLASS_NAME + "dropDatabaseTables() exit"); - } - } -} diff --git a/java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializer.java b/java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializer.java deleted file mode 100644 index cc6a670dfd..0000000000 --- a/java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializer.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.dbconfig; - -import java.io.InputStream; -import java.sql.Connection; - -/** - * This is the master class having public utility APIs exposed for DAS sample creater - for table and data maintainance. - * - */ -public class DBInitializer { - private static final String DEFAULT_CANNED_DB_CONFIGURATION = "CannedSampleDBConfig.xml"; - - /** - * Database configuration model - */ - protected DBConfig dbConfig; - - /** - * Database connection - */ - protected Connection connection; - - /** - * To manage database connection - */ - protected DBConnectionHelper dbConnectionHelper; - - /** - * To manage database phisical structure - */ - protected DBHelper dbHelper; - - /** - * To manage database population - */ - protected DBDataHelper dbDataHelper; - - /** - * Create instance of DBInitHelper based on default canned database configuration - * - * @param dbconfigFileLocation - * @throws Exception - */ - public DBInitializer() { - InputStream dbConfigStream = this.getClass().getClassLoader().getResourceAsStream(DEFAULT_CANNED_DB_CONFIGURATION); - init(dbConfigStream); - } - - /** - * Create instance of DBInitHelper based on Config file location - * - * @param dbconfigFileLocation - * @throws Exception - */ - public DBInitializer(String dbconfigFileLocation) throws Exception { - InputStream dbConfigStream = this.getClass().getClassLoader().getResourceAsStream(dbconfigFileLocation); - init(dbConfigStream); - } - - /** - * Create instance of DBInitHelper based on Config stream - * - * @param dbconfigStream - * @throws Exception - */ - public DBInitializer(InputStream dbConfigStream) throws Exception { - init(dbConfigStream); - } - - /** - * Initialize helper members based on Config - * - * @param dbconfigStream - */ - protected void init(InputStream dbconfigStream) { - dbConfig = DBConfigUtil.loadDBConfig(dbconfigStream); - - dbConnectionHelper = new DBConnectionHelper(); - dbHelper = new DBHelper(dbConfig); - dbDataHelper = new DBDataHelper(dbConfig); - - } - - /** - * Check if the Database and all tables have been created on the database - * - * @return return true if tables exist, else return false. - */ - public boolean isDatabaseReady() { - return dbHelper.isDatabaseReady(); - } - - /** - * - * @return - return true if all tables have at least a row, false otherwise - */ - public boolean isDatabasePopulated() { - return dbDataHelper.isDatabasePopulated(); - } - - /** - * Create tables and populate data. - * - * @param clean - If true, tables will be force dropped and recreated, else it will skip table creation for pre-existing tables. - * @throws Exception - */ - public void initializeDatabase(boolean clean) throws DatabaseInitializerException { - if (clean) { - dbHelper.dropDatabaseTables(); - } - dbHelper.initializeDatabase(); - dbDataHelper.initializeDatabaseData(); - } - - /** - * Populate database data - * - * @param clean If true, table data will be droped before data is created - */ - public void initializeDatabaseData(boolean clean) throws DatabaseInitializerException{ - if (clean) { - dbDataHelper.deleteDatabaseData(); - } - dbDataHelper.initializeDatabaseData(); - } - - /** - * Refresh data in tables. - * - * @throws Exception - */ - public void refreshDatabaseData() throws DatabaseInitializerException { - initializeDatabase(true); - } -} diff --git a/java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DataSourceInitializationException.java b/java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DataSourceInitializationException.java deleted file mode 100644 index ef5bef7761..0000000000 --- a/java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DataSourceInitializationException.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.dbconfig; - -/** - * - * Class responsible to throw exception encountered when initializing DataSource. - * - */ -public class DataSourceInitializationException extends RuntimeException { - private static final long serialVersionUID = 302160989411041041L; - - public DataSourceInitializationException(String string) { - super(string); - } - - public DataSourceInitializationException(Throwable e){ - super(e); - } - - public DataSourceInitializationException(String string, Throwable e) { - super(string, e); - } -} diff --git a/java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DatabaseInitializerException.java b/java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DatabaseInitializerException.java deleted file mode 100644 index 8c4fd0d71b..0000000000 --- a/java/das/samples/dbconfig/src/main/java/org/apache/tuscany/das/rdb/dbconfig/DatabaseInitializerException.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.dbconfig; - -/** - * - * Class responsible to throw exception encountered when initializing DataSource. - * - */ -public class DatabaseInitializerException extends RuntimeException { - private static final long serialVersionUID = 302160989411041041L; - - public DatabaseInitializerException(String string) { - super(string); - } - - public DatabaseInitializerException(Throwable e){ - super(e); - } - - public DatabaseInitializerException(String string, Throwable e) { - super(string, e); - } -} diff --git a/java/das/samples/dbconfig/src/main/resources/CannedSampleDBConfig.xml b/java/das/samples/dbconfig/src/main/resources/CannedSampleDBConfig.xml deleted file mode 100644 index 2b7b1ba1fd..0000000000 --- a/java/das/samples/dbconfig/src/main/resources/CannedSampleDBConfig.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - 'ACME Publishing' - 'Do-rite plumbing' - 'MegaCorp' -
- - 'Advanced Technologies', 'NY', '123', 1 - 'Default Name', '', '', 51 - 'Default Name', '', '', 51 - 'Default Name', '', '', 51 - 'Default Name', '', '', 51 - 'Default Name', '', '', 51 - 'Default Name', '', '', 51 -
- - 'John Jones','E0001',0,12 - 'Mary Smith','E0002',1,null - 'Jane Doe','E0003',0,12 - 'Al Smith','E0004',1,12 -
-
diff --git a/java/das/samples/dbconfig/src/main/resources/DBConfig.xsd b/java/das/samples/dbconfig/src/main/resources/DBConfig.xsd deleted file mode 100644 index 798c88c75c..0000000000 --- a/java/das/samples/dbconfig/src/main/resources/DBConfig.xsd +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/das/samples/dbconfig/src/main/resources/META-INF/LICENSE b/java/das/samples/dbconfig/src/main/resources/META-INF/LICENSE deleted file mode 100644 index fb4df3722c..0000000000 --- a/java/das/samples/dbconfig/src/main/resources/META-INF/LICENSE +++ /dev/null @@ -1,353 +0,0 @@ - - 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. - -=============================================================================================================== - -Other components and dependencies under Apache Software License 2.0 : - - log4j-1.2.14.jar - Apache Logging Services - derby 10.2.2.0.jar - Apache Derby - stax-api-1.0.1.jar - The Streaming API for XML (StAX) - wstx-asl-3.2.0.jar - WoodStox StAX implementation - standard-1.1.1.jar - The Apache Jackarta Taglibs - jstl-1.1.2.jar - The Apache Jackarta Taglibs - *.tld - The Apache Jackarta Taglibs - -=============================================================================================================== - - -Apache Tuscany SDO for Java Subcomponents -=========================================: - -The Tuscany SDO for Java release 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. - -License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar) - -Permission to copy, make derivative works of, and distribute the Service Data Objects -JavaDoc and Interface Definition Files files in any medium without fee or royalty as part -of a compliant implementation of the Service Data Objects Specification is hereby granted. -The Service Data Objects Specification may be found at any of the following locations: - -http://dev2dev.bea.com/technologies/commonj/index.jsp -http://www.ibm.com/developerworks/library/specification/ws-sdo/ -http://oracle.com/technology/webservices/sca -https://www.sdn.sap.com/ -http://www.xcalia/xdn/specs/sdo - -THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES -ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS -SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS, -INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, -NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE -SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES. - -The name and trademarks of the Authors may NOT be used in any manner, including advertising or -publicity pertaining to the Service Component Architecture Specification or its contents without specific, -written prior permission. Title to copyright in the Service Data Objects Specification and the -JavaDoc and Interface Definition Files will at all times remain with the Authors. - -No other rights are granted by implication, estoppel or otherwise. - -================================================================================================================= - -For the Eclipse EMF components -(codegen-2.2.3.jar -codegen-ecore-2.2.3.jar -common-2.2.3.jar -ecore-2.2.3.jar -ecore-change-2.2.3.jar -ecore-xmi-2.2.3.jar -xsd-2.2.3.jar) - -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. - -=================================================================================================== diff --git a/java/das/samples/dbconfig/src/main/resources/META-INF/NOTICE b/java/das/samples/dbconfig/src/main/resources/META-INF/NOTICE deleted file mode 100644 index c2cf1f95b4..0000000000 --- a/java/das/samples/dbconfig/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,32 +0,0 @@ -Apache Tuscany SDO for Java -Copyright 2006, 2007 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - -Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF), -sponsored by the Apache 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. - -Unless otherwise indicated, all distribution made available by the Apache Software Foundation -is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL"). -A copy of the AL is provided with this distribution as the LICENSE.txt file present in the -root directory, and is also available at http://www.apache.org/licenses/. - -The terms and conditions governing the distribution may refer to the AL or other license -agreements, notices or terms and conditions. Some of these other license agreements may -include (but are not limited to): - - . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html) - -It is your obligation to read and accept all such terms and conditions prior to use of the -distribution. If term or condition is provided, please contact the Apache Software Foundation -to determine what terms and conditions govern that particular distribution. - -This product also includes software developed by the Open Service Oriented Architecture organisation -(http://osoa.org). The license for this software may be found in the LICENSE.txt file contained in this -distribution. diff --git a/java/das/samples/dbconfig/src/main/resources/META-INF/README b/java/das/samples/dbconfig/src/main/resources/META-INF/README deleted file mode 100644 index 723f3fd3ab..0000000000 --- a/java/das/samples/dbconfig/src/main/resources/META-INF/README +++ /dev/null @@ -1,35 +0,0 @@ -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/java/das/samples/dbconfig/src/main/resources/log4j.properties b/java/das/samples/dbconfig/src/main/resources/log4j.properties deleted file mode 100644 index 3b0e5074da..0000000000 --- a/java/das/samples/dbconfig/src/main/resources/log4j.properties +++ /dev/null @@ -1,33 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# -# Set root logger level to DEBUG and its only appender to A1. - -log4j.rootLogger=NONE, NULL - -# NULL Appender -log4j.appender.NULL=org.apache.log4j.varia.NullAppender - -log4j.appender.NULL.layout=org.apache.log4j.PatternLayout -log4j.appender.NULL.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n - -# CONSOLE is set to be a ConsoleAppender. -log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender -log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout - -# Print only messages of level WARN or above in the package com.foo. -log4j.logger.org.apache.tuscany=NONE \ No newline at end of file diff --git a/java/das/samples/dbconfig/src/test/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializerTestCase.java b/java/das/samples/dbconfig/src/test/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializerTestCase.java deleted file mode 100644 index 3bd0bae407..0000000000 --- a/java/das/samples/dbconfig/src/test/java/org/apache/tuscany/das/rdb/dbconfig/DBInitializerTestCase.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.dbconfig; - -import junit.framework.TestCase; - - - -/** - * Tests the Converter framwork - */ -public class DBInitializerTestCase extends TestCase { - - protected void setUp() throws Exception { - super.setUp(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - - public void testCreateDatabase() throws Exception { - DBInitializer dbInitializer = new DBInitializer("dbConfig.xml"); - dbInitializer.initializeDatabase(true); - } - - public void something() throws Exception { -// try{ -// //DBInitHelper dbInit = new DBInitHelper("DBConfig.xml"); -// DBInitializer dbInit = new DBInitializer(new FileInputStream("c:/DBConfig.xml")); -// dbInit.initializeDatabase(true); -// -// System.out.println("check schema created:"+dbInit.isDatabaseReady()); -// System.out.println("check data created:"+dbInit.isDataCreated()); -// -// dbInit.deleteData(); -// System.out.println("check data created after deleteData:"+dbInit.isDataCreated()); -// -// dbInit.deleteSchema(); -// System.out.println("after deleteSchema check schema created:"+dbInit.isDatabaseReady()); -// -// dbInit.createSchema(false); -// System.out.println("check schema created after createSchema:"+dbInit.isDatabaseReady()); -// -// dbInit.refreshData(true); -// System.out.println("check data created after refreshData:"+dbInit.isDataCreated()); -// }catch(Exception e){ -// e.printStackTrace(); -// } - } -} diff --git a/java/das/samples/dbconfig/src/test/resources/dbConfig.xml b/java/das/samples/dbconfig/src/test/resources/dbConfig.xml deleted file mode 100644 index 51cb1c11d7..0000000000 --- a/java/das/samples/dbconfig/src/test/resources/dbConfig.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - 51, 'ACME Publishing', 0 - 52, 'Do-rite plumbing', 0 - 53, 'MegaCorp', 0 -
- - 'Advanced Technologies', 'NY', '123', 1 - 'Default Name', '', '', 51 - 'Default Name', '', '', 51 - 'Default Name', '', '', 51 - 'Default Name', '', '', 51 - 'Default Name', '', '', 51 - 'Default Name', '', '', 51 -
- - 'John Jones','E0001',0,12 - 'Mary Smith','E0002',1,null - 'Jane Doe','E0003',0,12 - 'Al Smith','E0004',1,12 -
- -
- -
-
diff --git a/java/das/samples/pom.xml b/java/das/samples/pom.xml deleted file mode 100644 index b95b8f9653..0000000000 --- a/java/das/samples/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.das - tuscany-das - 1.0-SNAPSHOT - - - org.apache.tuscany.das.samples - tuscany-das-samples - pom - Tuscany DAS Samples - - - dbconfig - company-webapp - advanced-webapp - customer - transaction - - diff --git a/java/das/samples/testing/tomcat/advanced-webapp/pom.xml b/java/das/samples/testing/tomcat/advanced-webapp/pom.xml deleted file mode 100644 index 4f54e1d820..0000000000 --- a/java/das/samples/testing/tomcat/advanced-webapp/pom.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.das.samples - tuscany-das-samples-testing-tomcat - 1.0-SNAPSHOT - - - tuscany-das-samples-testing-tomcat-advanced-webapp - jar - Tuscany Testing Ajax DAS Web Sample - Testing Tomcat Ajax DAS end user test - - - - - junit - junit - 3.8.1 - test - - - htmlunit - htmlunit - 1.9 - test - - - - - - - - org.apache.maven.plugins - maven-antrun-plugin - - - jakarta-regexp - jakarta-regexp - 1.4 - - - ant - ant-jakarta-regexp - 1.6.1 - - - ant - ant-xslp - 1.6.5 - - - ant - ant-trax - 1.6.5 - - - - - - diff --git a/java/das/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/LICENSE b/java/das/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/LICENSE deleted file mode 100644 index fb4df3722c..0000000000 --- a/java/das/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/LICENSE +++ /dev/null @@ -1,353 +0,0 @@ - - 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. - -=============================================================================================================== - -Other components and dependencies under Apache Software License 2.0 : - - log4j-1.2.14.jar - Apache Logging Services - derby 10.2.2.0.jar - Apache Derby - stax-api-1.0.1.jar - The Streaming API for XML (StAX) - wstx-asl-3.2.0.jar - WoodStox StAX implementation - standard-1.1.1.jar - The Apache Jackarta Taglibs - jstl-1.1.2.jar - The Apache Jackarta Taglibs - *.tld - The Apache Jackarta Taglibs - -=============================================================================================================== - - -Apache Tuscany SDO for Java Subcomponents -=========================================: - -The Tuscany SDO for Java release 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. - -License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar) - -Permission to copy, make derivative works of, and distribute the Service Data Objects -JavaDoc and Interface Definition Files files in any medium without fee or royalty as part -of a compliant implementation of the Service Data Objects Specification is hereby granted. -The Service Data Objects Specification may be found at any of the following locations: - -http://dev2dev.bea.com/technologies/commonj/index.jsp -http://www.ibm.com/developerworks/library/specification/ws-sdo/ -http://oracle.com/technology/webservices/sca -https://www.sdn.sap.com/ -http://www.xcalia/xdn/specs/sdo - -THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES -ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS -SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS, -INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, -NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE -SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES. - -The name and trademarks of the Authors may NOT be used in any manner, including advertising or -publicity pertaining to the Service Component Architecture Specification or its contents without specific, -written prior permission. Title to copyright in the Service Data Objects Specification and the -JavaDoc and Interface Definition Files will at all times remain with the Authors. - -No other rights are granted by implication, estoppel or otherwise. - -================================================================================================================= - -For the Eclipse EMF components -(codegen-2.2.3.jar -codegen-ecore-2.2.3.jar -common-2.2.3.jar -ecore-2.2.3.jar -ecore-change-2.2.3.jar -ecore-xmi-2.2.3.jar -xsd-2.2.3.jar) - -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. - -=================================================================================================== diff --git a/java/das/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/NOTICE b/java/das/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/NOTICE deleted file mode 100644 index c2cf1f95b4..0000000000 --- a/java/das/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,32 +0,0 @@ -Apache Tuscany SDO for Java -Copyright 2006, 2007 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - -Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF), -sponsored by the Apache 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. - -Unless otherwise indicated, all distribution made available by the Apache Software Foundation -is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL"). -A copy of the AL is provided with this distribution as the LICENSE.txt file present in the -root directory, and is also available at http://www.apache.org/licenses/. - -The terms and conditions governing the distribution may refer to the AL or other license -agreements, notices or terms and conditions. Some of these other license agreements may -include (but are not limited to): - - . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html) - -It is your obligation to read and accept all such terms and conditions prior to use of the -distribution. If term or condition is provided, please contact the Apache Software Foundation -to determine what terms and conditions govern that particular distribution. - -This product also includes software developed by the Open Service Oriented Architecture organisation -(http://osoa.org). The license for this software may be found in the LICENSE.txt file contained in this -distribution. diff --git a/java/das/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/README b/java/das/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/README deleted file mode 100644 index 723f3fd3ab..0000000000 --- a/java/das/samples/testing/tomcat/advanced-webapp/src/main/resources/META-INF/README +++ /dev/null @@ -1,35 +0,0 @@ -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/java/das/samples/testing/tomcat/advanced-webapp/src/test/java/org/apache/tuscany/test/das/AjaxDasTestCase.java b/java/das/samples/testing/tomcat/advanced-webapp/src/test/java/org/apache/tuscany/test/das/AjaxDasTestCase.java deleted file mode 100644 index 1335b4c484..0000000000 --- a/java/das/samples/testing/tomcat/advanced-webapp/src/test/java/org/apache/tuscany/test/das/AjaxDasTestCase.java +++ /dev/null @@ -1,596 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.test.das; - -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - - -import junit.framework.TestCase; - -import com.gargoylesoftware.htmlunit.BrowserVersion; -import com.gargoylesoftware.htmlunit.CollectingAlertHandler; -import com.gargoylesoftware.htmlunit.WebClient; -import com.gargoylesoftware.htmlunit.html.FrameWindow; -import com.gargoylesoftware.htmlunit.html.HtmlAnchor; -import com.gargoylesoftware.htmlunit.html.HtmlButtonInput; -import com.gargoylesoftware.htmlunit.html.HtmlForm; -import com.gargoylesoftware.htmlunit.html.HtmlOption; -import com.gargoylesoftware.htmlunit.html.HtmlPage; -import com.gargoylesoftware.htmlunit.html.HtmlRadioButtonInput; -import com.gargoylesoftware.htmlunit.html.HtmlSelect; - -public class AjaxDasTestCase extends TestCase { - public static final String testUrl = "http://localhost:8080/sample-advanced-webapp"; - - protected WebClient _webClient; - protected URL _url; - final List collectedAlerts = new ArrayList(); - - protected void setUp() throws Exception { - //New HTMLunit web client - _webClient = new WebClient(BrowserVersion.MOZILLA_1_0); - //System.out.println("SETTING ALERT HANDLER"); - _webClient.setAlertHandler( new CollectingAlertHandler(collectedAlerts) ); - _webClient.setRedirectEnabled(true); - // Going to have the WebClient connect to this URL - _url = new URL(testUrl); - } - - public void testHomepage() throws Exception { - final String TEST_CASE = "AjaxDASHomePage"; - System.out.print("Running:" + TEST_CASE + "\t\t\t"); - //System.out.println("js enabled?"+_webClient.isJavaScriptEnabled()); - final HtmlPage page = (HtmlPage) _webClient.getPage(_url); - //System.out.println("page title:"+page.getTitleText()); - String responseText = page.asText(); - //System.out.println("page html-->\n" + responseText); - //check page header - assertTrue(-1 != responseText.indexOf("Tuscany DAS Web Sample")); - - FrameWindow menuFrame = page.getFrameByName("fixed"); - HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage(); - String menuResponseText = menuPage.asText(); - //System.out.println("menu html-->\n" + menuResponseText); - //check main menu and sub menu - assertTrue(-1 != menuResponseText.indexOf("Advanced Features")); - assertTrue(-1 != menuResponseText.indexOf("OCC")); - assertTrue(-1 != menuResponseText.indexOf("Converter")); - assertTrue(-1 != menuResponseText.indexOf("Result Set Shape")); - assertTrue(-1 != menuResponseText.indexOf("Adhoc Query")); - assertTrue(-1 != menuResponseText.indexOf("Command")); - - collectedAlerts.clear(); - System.out.println("SUCCESS!!!"); - } - - public void testDBRefresh() throws Exception{ - final String TEST_CASE = "DBRefresh"; - System.out.print("Running:" + TEST_CASE + "\t\t"); - - final HtmlPage page = (HtmlPage) _webClient.getPage(_url); - FrameWindow menuFrame = page.getFrameByName("fixed"); - HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage(); - HtmlButtonInput commandButton = (HtmlButtonInput)menuPage.getFormByName("MenuForm").getHtmlElementById("refreshButton"); - HtmlPage commandResult = null; - if(commandButton != null){ - //System.out.println("command button text:"+commandButton.asText()); - commandButton.focus(); - //System.out.println("command button script:"+commandButton.getOnClickAttribute()); - commandResult = (HtmlPage)commandButton.click(); - } - - //System.out.println("alerts size:"+collectedAlerts.size()); - //if(collectedAlerts.size() > 0){ - //for(int i=0; i\n"+commandResultText); - - while(commandResultText.indexOf("Refreshed database!") == -1){ - Thread.sleep(1000); - commandResultText = commandResult.asText(); - //System.out.println("commandResultText-->\n" + commandResultText); - } - assertTrue(-1 != commandResultText.indexOf("Refreshed database!")); - - collectedAlerts.clear(); - System.out.println("SUCCESS!!!"); - } - - public void testAllCompanies_Adhoc() throws Exception{ - final String TEST_CASE = "AllCompanies_Adhoc"; - System.out.print("Running:" + TEST_CASE + "\t\t\t"); - - final HtmlPage page = (HtmlPage) _webClient.getPage(_url); - FrameWindow menuFrame = page.getFrameByName("fixed"); - HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage(); - - //basic content - HtmlAnchor adhocAnchor = menuPage.getAnchorByHref("./indexAdhoc.jsp"); - HtmlPage adhocPage = (HtmlPage)adhocAnchor.click(); - String adhocText = adhocPage.asText(); - //System.out.println("adhoc html-->\n" + adhocText); - assertTrue(-1 != adhocText.indexOf("Adhoc SQL Query"));//heading - assertTrue(-1 != adhocText.indexOf("ExecuteQuery"));//button text - - //list values - HtmlForm adhocForm = adhocPage.getFormByName("DasForm"); - //adhocPage.getEnclosingWindow().getWebClient() - HtmlSelect adhocList = (HtmlSelect)adhocForm.getHtmlElementById("sqlQuery"); - List adhocListOptions = adhocList.getOptions();//.asText(); - //System.out.println(" adhocListOptionsText-->\n" + adhocListOptions.toString()); - String allOptionsText = ""; - for(int i=0; i1"));//check each option - assertTrue(-1 != allOptionsText.indexOf("UPDATE DEPARTMENT SET NAME='MyUpdDept' WHERE COMPANYID=1 AND ID=1"));//check each option - - //check result - HtmlButtonInput adhocButton = (HtmlButtonInput)adhocForm.getHtmlElementById("queryButton"); - adhocButton.focus(); - HtmlPage adhocResult = (HtmlPage)adhocButton.click(); - String adhocResultText = adhocResult.asText(); - //System.out.println("initial result:"+adhocResultText); - - //System.out.println("alerts size:"+collectedAlerts.size()); - //if(collectedAlerts.size() > 0){ - // for(int i=0; i\n" + commandText); - assertTrue(-1 != commandText.indexOf("DAS Command:"));//heading - assertTrue(-1 != commandText.indexOf("ExecuteCommand"));//button text - - //list values - HtmlForm commandForm = commandPage.getFormByName("DasForm"); - HtmlSelect commandList = (HtmlSelect)commandForm.getHtmlElementById("DasCommand"); - List commandListOptions = commandList.getOptions(); - //System.out.println(" commandListOptionsText-->\n" + commandListOptions.toString()); - String allOptionsText = ""; - for(int i=0; i 0){ - //for(int i=0; i\n"+commandResultText); - - while(commandResultText.indexOf("das:DataGraphRoot") == -1){ - Thread.sleep(1000); - commandResultText = commandResult.asText(); - } - //System.out.println("commandResultText-->\n" + commandResultText); - - assertTrue(-1 != commandResultText.indexOf("ACME Publishing")); - assertTrue(-1 != commandResultText.indexOf("Do-rite plumbing")); - assertTrue(-1 != commandResultText.indexOf("MegaCorp")); - assertTrue(-1 != commandResultText.indexOf("Advanced Technologies")); - assertTrue(-1 != commandResultText.indexOf("COMPANYID")); - assertTrue(-1 != commandResultText.indexOf("1")); - - collectedAlerts.clear(); - System.out.println("SUCCESS!!!"); - } - - public void testInsertCompanies_Adhoc() throws Exception{ - final String TEST_CASE = "InsertCompanies_Adhoc"; - System.out.print("Running:" + TEST_CASE + "\t\t\t"); - - final HtmlPage page = (HtmlPage) _webClient.getPage(_url); - FrameWindow menuFrame = page.getFrameByName("fixed"); - HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage(); - - //basic content - HtmlAnchor adhocAnchor = menuPage.getAnchorByHref("./indexAdhoc.jsp"); - HtmlPage adhocPage = (HtmlPage)adhocAnchor.click(); - String adhocText = adhocPage.asText(); - //System.out.println("adhoc html-->\n" + adhocText); - assertTrue(-1 != adhocText.indexOf("Adhoc SQL Query"));//heading - assertTrue(-1 != adhocText.indexOf("ExecuteQuery"));//button text - - //list values - HtmlForm adhocForm = adhocPage.getFormByName("DasForm"); - //adhocPage.getEnclosingWindow().getWebClient() - HtmlSelect adhocList = (HtmlSelect)adhocForm.getHtmlElementById("sqlQuery"); - List adhocListOptions = adhocList.getOptions();//.asText(); - //System.out.println(" adhocListOptionsText-->\n" + adhocListOptions.toString()); - String allOptionsText = ""; - for(int i=0; i1"));//check each option - assertTrue(-1 != allOptionsText.indexOf("UPDATE DEPARTMENT SET NAME='MyUpdDept' WHERE COMPANYID=1 AND ID=1"));//check each option - - //check result - HtmlButtonInput adhocButton = (HtmlButtonInput)adhocForm.getHtmlElementById("queryButton"); - HtmlPage adhocResult = (HtmlPage)adhocButton.click(); - - //System.out.println("alerts size:"+collectedAlerts.size()); - //if(collectedAlerts.size() > 0){ - //for(int i=0; i\n" + adhocResultText); - } - - assertTrue(-1 != adhocResultText.indexOf("ACME Publishing")); - assertTrue(-1 != adhocResultText.indexOf("Do-rite plumbing")); - assertTrue(-1 != adhocResultText.indexOf("MegaCorp")); - assertTrue(-1 != adhocResultText.indexOf("Advanced Technologies")); - assertTrue(-1 != adhocResultText.indexOf("COMPANYID")); - assertTrue(-1 != adhocResultText.indexOf("1")); - assertTrue(-1 != adhocResultText.indexOf("MyDept")); - assertTrue(adhocResultText.indexOf("COMPANYID") != adhocResultText.lastIndexOf("COMPANYID")); - - collectedAlerts.clear(); - System.out.println("SUCCESS!!!"); - } - - public void testDeleteDepartment_Command() throws Exception{ - final String TEST_CASE = "DeleteDepartment_Command"; - System.out.print("Running:" + TEST_CASE + "\t\t"); - - final HtmlPage page = (HtmlPage) _webClient.getPage(_url); - FrameWindow menuFrame = page.getFrameByName("fixed"); - HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage(); - - //basic content - HtmlAnchor commandAnchor = menuPage.getAnchorByHref("./indexCommand.jsp"); - HtmlPage commandPage = (HtmlPage)commandAnchor.click(); - String commandText = commandPage.asText(); - //System.out.println("command html-->\n" + commandText); - assertTrue(-1 != commandText.indexOf("DAS Command:"));//heading - assertTrue(-1 != commandText.indexOf("ExecuteCommand"));//button text - - //list values - HtmlForm commandForm = commandPage.getFormByName("DasForm"); - HtmlSelect commandList = (HtmlSelect)commandForm.getHtmlElementById("DasCommand"); - List commandListOptions = commandList.getOptions(); - //System.out.println(" commandListOptionsText-->\n" + commandListOptions.toString()); - String allOptionsText = ""; - for(int i=0; i 0){ - //for(int i=0; i\n"+commandResultText); - - while(commandResultText.indexOf("das:DataGraphRoot") == -1){ - Thread.sleep(1000); - commandResultText = commandResult.asText(); - //System.out.println("commandResultText-->\n" + commandResultText); - } - - assertTrue(-1 != commandResultText.indexOf("ACME Publishing")); - assertTrue(-1 != commandResultText.indexOf("Do-rite plumbing")); - assertTrue(-1 != commandResultText.indexOf("MegaCorp")); - assertTrue(-1 != commandResultText.indexOf("Advanced Technologies")); - assertTrue(-1 != commandResultText.indexOf("COMPANYID")); - assertTrue(-1 != commandResultText.indexOf("1")); - - collectedAlerts.clear(); - System.out.println("SUCCESS!!!"); - } - - public void testOCC() throws Exception{ - final String TEST_CASE = "OCC"; - System.out.print("Running:" + TEST_CASE + "\t\t"); - - final HtmlPage page = (HtmlPage) _webClient.getPage(_url); - FrameWindow menuFrame = page.getFrameByName("fixed"); - HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage(); - - //basic content - HtmlAnchor commandAnchor = menuPage.getAnchorByHref("./occ.jsp"); - HtmlPage commandPage = (HtmlPage)commandAnchor.click(); - String commandText = commandPage.asText(); - //System.out.println("command html-->\n" + commandText); - assertTrue(-1 != commandText.indexOf("Automatic Optimistic Concurrency Control:"));//heading - assertTrue(-1 != commandText.indexOf("ExecuteTransaction"));//button text - - //list values - HtmlForm commandForm = commandPage.getFormByName("DasForm"); - //check result - HtmlButtonInput commandButton = (HtmlButtonInput)commandForm.getHtmlElementById("occButton"); - HtmlPage commandResult = null; - if(commandButton != null){ - //System.out.println("command button text:"+commandButton.asText()); - commandButton.focus(); - //System.out.println("command button script:"+commandButton.getOnClickAttribute()); - commandResult = (HtmlPage)commandButton.click(); - } - - //System.out.println("alerts size:"+collectedAlerts.size()); - //if(collectedAlerts.size() > 0){ - //for(int i=0; i\n"+commandResultText); - - while(commandResultText.indexOf("collision") == -1){ - Thread.sleep(1000); - commandResultText = commandResult.asText(); - //System.out.println("commandResultText-->\n" + commandResultText); - } - - assertTrue(-1 != commandResultText.indexOf("An update collision occurred")); - - collectedAlerts.clear(); - System.out.println("SUCCESS!!!"); - } - - public void testRSS() throws Exception{ - final String TEST_CASE = "RSS"; - System.out.print("Running:" + TEST_CASE + "\t\t"); - - final HtmlPage page = (HtmlPage) _webClient.getPage(_url); - FrameWindow menuFrame = page.getFrameByName("fixed"); - HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage(); - - //basic content - HtmlAnchor commandAnchor = menuPage.getAnchorByHref("./rss.jsp"); - HtmlPage commandPage = (HtmlPage)commandAnchor.click(); - String commandText = commandPage.asText(); - //System.out.println("command html-->\n" + commandText); - assertTrue(-1 != commandText.indexOf("Result Set Shape:"));//heading - assertTrue(-1 != commandText.indexOf("ExecuteQuery"));//button text - - //list values - HtmlForm commandForm = commandPage.getFormByName("DasForm"); - //check result - HtmlButtonInput commandButton = (HtmlButtonInput)commandForm.getHtmlElementById("rssButton"); - HtmlPage commandResult = null; - if(commandButton != null){ - //System.out.println("command button text:"+commandButton.asText()); - commandButton.focus(); - //System.out.println("command button script:"+commandButton.getOnClickAttribute()); - commandResult = (HtmlPage)commandButton.click(); - } - - //System.out.println("alerts size:"+collectedAlerts.size()); - //if(collectedAlerts.size() > 0){ - //for(int i=0; i\n"+commandResultText); - - while(commandResultText.indexOf("das:DataGraphRoot") == -1){ - Thread.sleep(1000); - commandResultText = commandResult.asText(); - } - - //System.out.println("commandResultText-->\n" + commandResultText); - - assertTrue(-1 != commandResultText.indexOf("Roosevelt")); - assertTrue(-1 != commandResultText.indexOf("1600 Pennsylvania Avenue")); - - collectedAlerts.clear(); - System.out.println("SUCCESS!!!"); - } - - public void testConverter() throws Exception{ - final String TEST_CASE = "Converter"; - System.out.print("Running:" + TEST_CASE + "\t\t"); - - final HtmlPage page = (HtmlPage) _webClient.getPage(_url); - FrameWindow menuFrame = page.getFrameByName("fixed"); - HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage(); - - //basic content - HtmlAnchor commandAnchor = menuPage.getAnchorByHref("./converter.jsp"); - HtmlPage commandPage = (HtmlPage)commandAnchor.click(); - String commandText = commandPage.asText(); - //System.out.println("command html-->\n" + commandText); - assertTrue(-1 != commandText.indexOf("Arbitrary Converter:"));//heading - assertTrue(-1 != commandText.indexOf("ExecuteTransaction"));//button text - - //list values - HtmlForm commandForm = commandPage.getFormByName("DasForm"); - //select first radio buttom - HtmlRadioButtonInput stmt0 = (HtmlRadioButtonInput)commandForm.getRadioButtonInput("stmt", "stmt0"); - if(stmt0 != null){ - //System.out.println("got stmt0"); - stmt0.setChecked(true); - } - - //check result - HtmlButtonInput commandButton = (HtmlButtonInput)commandForm.getHtmlElementById("converterButton"); - HtmlPage commandResult = null; - if(commandButton != null){ - //System.out.println("command button text:"+commandButton.asText()); - commandButton.focus(); - //System.out.println("command button script:"+commandButton.getOnClickAttribute()); - commandResult = (HtmlPage)commandButton.click(); - } - - //System.out.println("alerts size:"+collectedAlerts.size()); - //if(collectedAlerts.size() > 0){ - //for(int i=0; i\n"+commandResultText); - - while(commandResultText.indexOf("das:DataGraphRoot") == -1){ - Thread.sleep(1000); - commandResultText = commandResult.asText(); - //System.out.println("commandResultText-->\n" + commandResultText); - } - assertTrue(-1 != commandResultText.indexOf("1957")); - - collectedAlerts.clear(); - System.out.println("SUCCESS!!!"); - } - - /** - * @param args - */ - public static void main(String[] args) throws Exception{ - AjaxDasTestCase t = new AjaxDasTestCase(); - t.setUp(); - try{ - ////t.testHomepage(); - //t.testAllCompanies_Adhoc(); - //t.testAllCompaniesDepartments_Command(); - //t.testInsertCompanies_Adhoc(); - //t.testDeleteDepartment_Command(); - //t.testOCC(); - ////t.testRSS(); - //t.testConverter(); - }catch(Exception e){ - e.printStackTrace(); - } - - } - -} diff --git a/java/das/samples/testing/tomcat/build.xml b/java/das/samples/testing/tomcat/build.xml deleted file mode 100644 index 3f38968476..0000000000 --- a/java/das/samples/testing/tomcat/build.xml +++ /dev/null @@ -1,309 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/das/samples/testing/tomcat/company-webapp/pom.xml b/java/das/samples/testing/tomcat/company-webapp/pom.xml deleted file mode 100644 index cb4ad55a52..0000000000 --- a/java/das/samples/testing/tomcat/company-webapp/pom.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.das.samples - tuscany-das-samples-testing-tomcat - 1.0-SNAPSHOT - - - tuscany-das-samples-testing-tomcat-company-webapp - jar - Tuscany Testing DAS Sample - Company-webapp - Testing Tomcat DAS end user test - - - - - junit - junit - 3.8.1 - test - - - htmlunit - htmlunit - 1.9 - test - - - - - - - - org.apache.maven.plugins - maven-antrun-plugin - - - jakarta-regexp - jakarta-regexp - 1.4 - - - ant - ant-jakarta-regexp - 1.6.1 - - - ant - ant-xslp - 1.6.5 - - - ant - ant-trax - 1.6.5 - - - - - - diff --git a/java/das/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/LICENSE b/java/das/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/LICENSE deleted file mode 100644 index 9597d92eb3..0000000000 --- a/java/das/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/LICENSE +++ /dev/null @@ -1,353 +0,0 @@ - - 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. - -=============================================================================================================== - -Other components and dependencies under Apache Software License 2.0 : - - log4j-1.2.14.jar - Apache Logging Services - derby 10.2.2.0.jar - Apache Derby - stax-api-1.0.1.jar - The Streaming API for XML (StAX) - wstx-asl-3.2.0.jar - WoodStox StAX implementation - standard-1.1.1.jar - The Apache Jackarta Taglibs - jstl-1.1.2.jar - The Apache Jackarta Taglibs - *.tld - The Apache Jackarta Taglibs - -=============================================================================================================== - - -Apache Tuscany SDO for Java Subcomponents -=========================================: - -The Tuscany SDO for Java release 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. - -License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar) - -Permission to copy, make derivative works of, and distribute the Service Data Objects -JavaDoc and Interface Definition Files files in any medium without fee or royalty as part -of a compliant implementation of the Service Data Objects Specification is hereby granted. -The Service Data Objects Specification may be found at any of the following locations: - -http://dev2dev.bea.com/technologies/commonj/index.jsp -http://www.ibm.com/developerworks/library/specification/ws-sdo/ -http://oracle.com/technology/webservices/sca -https://www.sdn.sap.com/ -http://www.xcalia/xdn/specs/sdo - -THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES -ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS -SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS, -INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, -NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE -SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES. - -The name and trademarks of the Authors may NOT be used in any manner, including advertising or -publicity pertaining to the Service Component Architecture Specification or its contents without specific, -written prior permission. Title to copyright in the Service Data Objects Specification and the -JavaDoc and Interface Definition Files will at all times remain with the Authors. - -No other rights are granted by implication, estoppel or otherwise. - -================================================================================================================= - -For the Eclipse EMF components -(codegen-2.2.3.jar -codegen-ecore-2.2.3.jar -common-2.2.3.jar -ecore-2.2.3.jar -ecore-change-2.2.3.jar -ecore-xmi-2.2.3.jar -xsd-2.2.3.jar) - -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. - -=================================================================================================== diff --git a/java/das/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/NOTICE b/java/das/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/NOTICE deleted file mode 100644 index e9d98fc7f5..0000000000 --- a/java/das/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,32 +0,0 @@ -Apache Tuscany SDO for Java -Copyright 2006, 2007 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - -Apache Tuscany is an effort undergoing incubation at The Apache Software Foundation (ASF), -sponsored by the Apache 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. - -Unless otherwise indicated, all distribution made available by the Apache Software Foundation -is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL"). -A copy of the AL is provided with this distribution as the LICENSE.txt file present in the -root directory, and is also available at http://www.apache.org/licenses/. - -The terms and conditions governing the distribution may refer to the AL or other license -agreements, notices or terms and conditions. Some of these other license agreements may -include (but are not limited to): - - . Eclipse Public License Version 1.0 (available at http://www.eclipse.org/legal/epl-v10.html) - -It is your obligation to read and accept all such terms and conditions prior to use of the -distribution. If term or condition is provided, please contact the Apache Software Foundation -to determine what terms and conditions govern that particular distribution. - -This product also includes software developed by the Open Service Oriented Architecture organisation -(http://osoa.org). The license for this software may be found in the LICENSE.txt file contained in this -distribution. diff --git a/java/das/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/README b/java/das/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/README deleted file mode 100644 index 9b26d1690a..0000000000 --- a/java/das/samples/testing/tomcat/company-webapp/src/main/resources/META-INF/README +++ /dev/null @@ -1,35 +0,0 @@ -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/java/das/samples/testing/tomcat/company-webapp/src/test/java/org/apache/tuscany/test/das/DasTestCase.java b/java/das/samples/testing/tomcat/company-webapp/src/test/java/org/apache/tuscany/test/das/DasTestCase.java deleted file mode 100644 index faa92d6994..0000000000 --- a/java/das/samples/testing/tomcat/company-webapp/src/test/java/org/apache/tuscany/test/das/DasTestCase.java +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.test.das; - -import java.net.URL; - -import junit.framework.TestCase; - -import com.gargoylesoftware.htmlunit.WebClient; -import com.gargoylesoftware.htmlunit.html.HtmlForm; -import com.gargoylesoftware.htmlunit.html.HtmlPage; -import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput; - -public class DasTestCase extends TestCase { - public static final String testUrl = "http://localhost:8080/sample-company-webapp/"; - - protected WebClient _webClient; - protected URL _url; - - protected void setUp() throws Exception { - //New HTMLunit web client - _webClient = new WebClient(); - _webClient.setRedirectEnabled(true); - - // Going to have the WebClient connect to this URL - _url = new URL(testUrl); - - } - - public void testHomepage() throws Exception { - final String TEST_CASE = "HomePage"; - System.out.print("Running:" + TEST_CASE + "\t\t\t"); - - final HtmlPage page = (HtmlPage) _webClient.getPage(_url); - //System.out.println(page.getTitleText()); - - String responseText = page.asText(); - //System.out.println("html-->\n" + responseText); - //check page header - assertTrue(-1 != responseText.indexOf("Tuscany DAS Companies WEB Example")); - //check table headers - assertTrue(-1 != responseText.indexOf("ID")); - assertTrue(-1 != responseText.indexOf("Name")); - assertTrue(-1 != responseText.indexOf("Department_ID")); - assertTrue(-1 != responseText.indexOf("Department_Name")); - //check companies values - //assertTrue(-1 != responseText.indexOf("51")); - assertTrue(-1 != responseText.indexOf("ACME Publishing")); - //assertTrue(-1 != responseText.indexOf("53")); - assertTrue(-1 != responseText.indexOf("Do-rite plumbing")); - //assertTrue(-1 != responseText.indexOf("53")); - assertTrue(-1 != responseText.indexOf("MegaCorp")); - //check departments - assertTrue(-1 != responseText.indexOf("Default Name 2")); - assertTrue(-1 != responseText.indexOf("Default Name 3")); - assertTrue(-1 != responseText.indexOf("Default Name 4")); - assertTrue(-1 != responseText.indexOf("Default Name 5")); - assertTrue(-1 != responseText.indexOf("Default Name 6")); - assertTrue(-1 != responseText.indexOf("Default Name 7")); - assertTrue(-1 != responseText.indexOf("Default Name 8")); - - System.out.println("SUCCESS!!!"); - } - - - public void testAllCompanies() throws Exception{ - final String TEST_CASE = "AllCompanies"; - System.out.print("Running:" + TEST_CASE + "\t\t\t"); - - // Get the first page - final HtmlPage page = (HtmlPage) _webClient.getPage(_url); - - // Get the form that we are dealing with and within that form, - // find the submit button and the field that we want to change. - final HtmlForm form = (HtmlForm) page.getForms().get(0); - final HtmlSubmitInput allCompaniesButton = (HtmlSubmitInput)form.getHtmlElementById("doFill"); - // Now submit the form by clicking the button - final HtmlPage resultPage = (HtmlPage)allCompaniesButton.click(); - - //verify the resultPage - String responseText = resultPage.asText(); - //System.out.println("html-->\n" + responseText); - // check table headers - assertTrue(-1 != responseText.indexOf("ID")); - assertTrue(-1 != responseText.indexOf("Name")); - //check table values - //assertTrue(-1 != responseText.indexOf("51")); - assertTrue(-1 != responseText.indexOf("ACME Publishing")); - //assertTrue(-1 != responseText.indexOf("52")); - assertTrue(-1 != responseText.indexOf("Do-rite plumbing")); - //assertTrue(-1 != responseText.indexOf("53")); - assertTrue(-1 != responseText.indexOf("MegaCorp")); - - System.out.println("SUCCESS!!!"); - } - - public void testAllCompaniesDepartments() throws Exception{ - final String TEST_CASE = "AllCompaniesDepartments"; - System.out.print("Running:" + TEST_CASE + "\t\t"); - - // Get the first page - final HtmlPage page = (HtmlPage) _webClient.getPage(_url); - - // Get the form that we are dealing with and within that form, - // find the submit button and the field that we want to change. - final HtmlForm form = (HtmlForm) page.getForms().get(0); - final HtmlSubmitInput allCompaniesButton = (HtmlSubmitInput)form.getHtmlElementById("doFillAll"); - // Now submit the form by clicking the button - final HtmlPage resultPage = (HtmlPage)allCompaniesButton.click(); - - //verify the resultPage - String responseText = resultPage.asText(); - //System.out.println("html-->\n" + responseText); - //check table headers - assertTrue(-1 != responseText.indexOf("ID")); - assertTrue(-1 != responseText.indexOf("Name")); - assertTrue(-1 != responseText.indexOf("Department_ID")); - assertTrue(-1 != responseText.indexOf("Department_Name")); - //check companies values - //assertTrue(-1 != responseText.indexOf("51")); - assertTrue(-1 != responseText.indexOf("ACME Publishing")); - //assertTrue(-1 != responseText.indexOf("53")); - assertTrue(-1 != responseText.indexOf("Do-rite plumbing")); - //assertTrue(-1 != responseText.indexOf("53")); - assertTrue(-1 != responseText.indexOf("MegaCorp")); - //check departments - assertTrue(-1 != responseText.indexOf("Default Name 2")); - assertTrue(-1 != responseText.indexOf("Default Name 3")); - assertTrue(-1 != responseText.indexOf("Default Name 4")); - assertTrue(-1 != responseText.indexOf("Default Name 5")); - assertTrue(-1 != responseText.indexOf("Default Name 6")); - assertTrue(-1 != responseText.indexOf("Default Name 7")); - assertTrue(-1 != responseText.indexOf("Default Name 8")); - - System.out.println("SUCCESS!!!"); - } - - public void testAddDepartmentToFirstCompany() throws Exception{ - final String TEST_CASE = "AddDepartmentToFirstCompany"; - System.out.print("Running:" + TEST_CASE + "\t"); - - // Get the first page - final HtmlPage page = (HtmlPage) _webClient.getPage(_url); - - // Get the form that we are dealing with and within that form, - // find the submit button and the field that we want to change. - final HtmlForm form = (HtmlForm) page.getForms().get(0); - final HtmlSubmitInput allCompaniesButton = (HtmlSubmitInput)form.getHtmlElementById("doAddDepartment"); - // Now submit the form by clicking the button - final HtmlPage resultPage = (HtmlPage)allCompaniesButton.click(); - - //verify the resultPage - String responseText = resultPage.asText(); - //System.out.println("html-->\n" + responseText); - //check new department - assertTrue(-1 != responseText.indexOf("8")); - - System.out.println("SUCCESS!!!"); - } - - public void testChangeCompanyDepartmentNames() throws Exception{ - final String TEST_CASE = "ChangeCompanyDepartmentNames"; - System.out.print("Running:" + TEST_CASE + "\t"); - - // Get the first page - final HtmlPage page = (HtmlPage) _webClient.getPage(_url); - - // Get the form that we are dealing with and within that form, - // find the submit button and the field that we want to change. - final HtmlForm form = (HtmlForm) page.getForms().get(0); - final HtmlSubmitInput allCompaniesButton = (HtmlSubmitInput)form.getHtmlElementById("doChangeDepartmentNames"); - // Now submit the form by clicking the button - final HtmlPage resultPage = (HtmlPage)allCompaniesButton.click(); - - //verify the resultPage - String responseText = resultPage.asText(); - //System.out.println("html-->\n" + responseText); - //check update departments - assertTrue(-1 != responseText.indexOf("Dept-")); - //also, check to not have old departments names (default name) - assertTrue(-1 == responseText.indexOf("Default Name")); - - System.out.println("SUCCESS!!!"); - } - - public void testDeleteCompanyOneDepartments() throws Exception{ - final String TEST_CASE = "DeleteCompanyOneDepartments"; - System.out.print("Running:" + TEST_CASE + "\t"); - - // Get the first page - final HtmlPage page = (HtmlPage) _webClient.getPage(_url); - - // Get the form that we are dealing with and within that form, - // find the submit button and the field that we want to change. - final HtmlForm form = (HtmlForm) page.getForms().get(0); - final HtmlSubmitInput allCompaniesButton = (HtmlSubmitInput)form.getHtmlElementById("doDeleteDepartments"); - // Now submit the form by clicking the button - final HtmlPage resultPage = (HtmlPage)allCompaniesButton.click(); - - //verify the resultPage - String responseText = resultPage.asText(); - //System.out.println("html-->\n" + responseText); - //check that al the company 1 departments are gone.. - assertTrue(-1 == responseText.indexOf("Default Name 2")); - assertTrue(-1 == responseText.indexOf("Default Name 3")); - assertTrue(-1 == responseText.indexOf("Default Name 4")); - assertTrue(-1 == responseText.indexOf("Default Name 5")); - assertTrue(-1 == responseText.indexOf("Default Name 6")); - assertTrue(-1 == responseText.indexOf("Default Name 7")); - assertTrue(-1 == responseText.indexOf("Default Name 8")); - - System.out.println("SUCCESS!!!"); - } - - /** - * @param args - */ - public static void main(String[] args) { - DasTestCase t = new DasTestCase(); - try{ - t.testHomepage(); - t.testAllCompanies(); - t.testAllCompaniesDepartments(); - t.testAddDepartmentToFirstCompany(); - t.testChangeCompanyDepartmentNames(); - t.testDeleteCompanyOneDepartments(); - }catch(Exception e){ - e.printStackTrace(); - } - - } - -} diff --git a/java/das/samples/testing/tomcat/context.xsl b/java/das/samples/testing/tomcat/context.xsl deleted file mode 100644 index 35a78a43a5..0000000000 --- a/java/das/samples/testing/tomcat/context.xsl +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/java/das/samples/testing/tomcat/datasource.xsl b/java/das/samples/testing/tomcat/datasource.xsl deleted file mode 100644 index ffd17f3271..0000000000 --- a/java/das/samples/testing/tomcat/datasource.xsl +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - Global Datasource for Derby dastest database - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/java/das/samples/testing/tomcat/pom.xml b/java/das/samples/testing/tomcat/pom.xml deleted file mode 100644 index 6ab37dccab..0000000000 --- a/java/das/samples/testing/tomcat/pom.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.das.samples - tuscany-das-samples - 1.0-SNAPSHOT - - - tuscany-das-samples-testing-tomcat - pom - Tuscany Testing in Tomcat - - - company-webapp - advanced-webapp - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - **/*TestCase.java - - - - - - - - src/test/java - - **/*.componentType - - - - src/test/resources - - **/* - - - - - - - - org.apache.maven.plugins - maven-antrun-plugin - 1.1 - - - prepareTomcat - process-test-resources - - - - - - - - - - - - run - - - - - cleanupTomcat - clean - - - - - - - - - run - - - - - - - - - test - - diff --git a/java/das/samples/testing/tomcat/readme.htm b/java/das/samples/testing/tomcat/readme.htm deleted file mode 100644 index e7fd28a4ac..0000000000 --- a/java/das/samples/testing/tomcat/readme.htm +++ /dev/null @@ -1,86 +0,0 @@ - - - - Tuscany End User Sample Testing - - -

Tuscany End User Sample Testing

-

Initial Setup

  -   Most of the following only needs to be done once -unless noted otherwise.
-
    -
  • Be sure JAVA_HOME variable is pointing to a Java JDK directory.
  • -
  • Follow the steps to build Tuscany DAS Companyweb sample application from DAS Java Developer Guide.
  • - -
  • Change directory -to java/das/samples/testing/tomcat.
  • - -
  • Download -Tomcat Core 6.0.xx zip -for Windows or  tar.gz for Linux  from Apache -Tomcat.
  • - -
  • You can place the tomcat distribution in your java/samples/das/testing/tomcat directory or, alternatively, you can create/edit {user home}/build.properties to -change the property tuscany.acceptance.tomcat.zipped to tell the build -environment where the tomcat distribution zip file is located.
  • -
  • You may have to edit build.xml  to change the property tuscany.acceptance.tomcat.version -to match the xx -to the specific version that you downloaded.
  • -
- -

 Running

In -the java/das/samples/testing/tomcat -directory run maven:
mvn

Explanation

Maven does -the following:
  • Unpacks the -Tomcat distribution into the target directory to ensure a pristine -environment.
  • It adds the appropriate Tuscany and it -dependencies jars into Tomcat (for more  details)
  • Does -the necessary changes -to Tomcat's configuration as required. (for more  details)
  • Deploys -Tuscany's DAS sample war files into Tomcat.
  • Starts -Tomcat (You should see another window running Tomcat) 
  • Begins -running HTML unit tests that should closely match running the samples -as a user would.
If all goes well at the end you -should see:
-
[INFO] ----------------------------------------------------------------------------
-[INFO] Reactor Summary:
-[INFO] ----------------------------------------------------------------------------
-[INFO] Tuscany Testing in Tomcat .............................. SUCCESS [0.961s]
-[INFO] Tuscany Testing Tomcat DAS Sample - Companyweb ......... SUCCESS [1:09.771s]
-[INFO] Tuscany Testing Ajax DAS Web Sample .................... SUCCESS [47.458s]
-[INFO] ----------------------------------------------------------------------------
-[INFO] ----------------------------------------------------------------------------
-[INFO] BUILD SUCCESSFUL
-[INFO] ---------------------------------------------------------------------------- -[INFO] Total time: 1 minute 59 seconds -[INFO] Finished at: Sun Jun 10 01:23:19 VET 2007 -[INFO] Final Memory: 9M/17M -[INFO] ----------------------------------------------------------------------------
-

Cleanup

Close -the Tomcat window and issue mvn clean.

Note

-

Because the html unit tests execute multiple user actions that change the contents of the database tables, is recommended -that you always run these tests in a clean environment (after a mvn clean), -otherwise you may experience failure on some tests as the expected result data might have been affected by previous test runs.

- - \ No newline at end of file diff --git a/java/das/samples/testing/tomcat/server.xsl b/java/das/samples/testing/tomcat/server.xsl deleted file mode 100644 index b53d1d50c7..0000000000 --- a/java/das/samples/testing/tomcat/server.xsl +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - org.apache.tuscany.tomcat.TuscanyHost - - - - - - - - diff --git a/java/das/samples/transaction/build.xml b/java/das/samples/transaction/build.xml deleted file mode 100644 index 5289215be5..0000000000 --- a/java/das/samples/transaction/build.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/das/samples/transaction/pom.xml b/java/das/samples/transaction/pom.xml deleted file mode 100644 index f6e50d779e..0000000000 --- a/java/das/samples/transaction/pom.xml +++ /dev/null @@ -1,148 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.das.samples - tuscany-das-samples - 1.0-SNAPSHOT - - - tuscany-das-sample-transaction - jar - Tuscany DAS J2SE Transaction Sample Using Transaction Manager - Sample use of RDB DAS in a J2SE application with Transaction Manager - - - - org.apache.tuscany.das - tuscany-das-rdb - ${das.version} - compile - - - - org.apache.tuscany.sdo - tuscany-sdo-impl - ${sdo.version} - compile - - - - org.apache.tuscany.sdo - tuscany-sdo-api-r2.1 - ${sdo.version} - compile - - - - org.apache.tuscany.das.samples - tuscany-das-sample-dbconfig - ${das.version} - compile - - - org.apache.derby - derby - - - - - - mysql - mysql-connector-java - 5.0.4 - compile - - - - org.apache.geronimo.specs - geronimo-jta_1.1_spec - 1.1 - - - - org.apache.geronimo.components - geronimo-transaction - 2.0.1 - - - mx4j - mx4j - - - commons-jelly-tags-velocity - commons-jelly - - - velocity - velocity - - - geronimo-core - org.apache.geronimo.modules - - - geronimo-kernel - org.apache.geronimo.modules - - - geronimo-system - org.apache.geronimo.modules - - - geronimo-j2ee - org.apache.geronimo.modules - - - - - - - - - sample-transaction - src/main/java - - - src/main/java - - - src/main/resources - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - org.apache.tuscany.samples.das.tx.sample.MoneyTransfer - true - - - - - - - - - diff --git a/java/das/samples/transaction/readme.htm b/java/das/samples/transaction/readme.htm deleted file mode 100644 index 6cf450d41a..0000000000 --- a/java/das/samples/transaction/readme.htm +++ /dev/null @@ -1,449 +0,0 @@ - - - - - - - - - -Tuscany RDB DAS Sample - - - - - - - - - - - -
- -

RDB DAS Transaction Sample

- -

 

- -

Introduction

- -

This stand-alone sample demonstrates the RDB Data Access Service -transaction management with external Transaction Manager. This example uses Geronimo - as the transaction manager.

- -

 

- -

Example

- -

In this MoneyTransfer example,user entered amount will be withdrawn from -one of his bankaccount using one call to das.applyChanges(dataGraph1) and same -amount will  be deposited to his another -account using another call to das.applyChanges(dataGraph2). Based on whether -user selects commit/rollback, these 2 applyChanges() will behave identically. -i.e. both will commit or both will rollback, but partial transaction will not -happen. Example build.xml - sets for transfer of 1200 from Account1 to Account2 -[commit].

- -

 

- -

Building and Running

- -

 From binary distribution, base -directory is {DAS_ROOT}\ samples\transaction. Refer to below settings from -this base directory.

- -

1]BankAccounts.xml available in sample-transaction.jar, is the DAS -config file. Note that, as transaction is externally managed, this uses -managedtx=false setting.

- -

 

- -

2]MySQL server should be running. The example uses MySQL DB (with innoDB -ON to support transaction). Database dastest, table bankaccount and -data will be created during sample run. For this preconfigured -BankAccountDBConfig.xml available in sample-transaction.jar, will be used. User -needs to set correct values for url, login etc. in this.

- -

 

- -

3] Apache Ant latest version should be installed.Download Apache Ant -latest version on and extract into folder <apache_ant_folder>. You can -find it here: http://ant.apache.org/bindownload.cgi.Add -<apache_ant_folder>/bin directory to your OS path variable.

- -

 

- -

4] From base directory run-  -ant

- -

 

- -

The sample will run and output the following:

- -
- -

Buildfile: build.xml

- -

 

- -

run:

- -

     [java] -INIT database

- -

     [java] -INIT transaction manager

- -

     [java] -Wed Sep 19 17:09:42 IST 2007 DEBUG: Executing XA statement: XA START

- -

 0x01000000000000004bceb90109b6b0f3000000000000000000000000000000000000000000000

- -

000000000000000000000000000000000000000000000000000,0x00000000000000000000000000

- -

00000000000000000000000000000000000000000000000000000000000000000000000000000000

- -

0000000000000000000000,0x4765526f

- -

     [java] -Get a connection

- -

     [java] -Before transaction, table is:

- -

     [java]     id      -name    balance

- -

     [java]     1       -John Feng       1200

- -

     [java]     2       -John Feng       0

- -

     [java] -Begin a transaction

- -

     [java] -Update the table - 2 accounts

- -

     [java] -*commit* the transaction

- -

     [java] -Wed Sep 19 17:09:45 IST 2007 DEBUG: Executing XA statement: XA END 0

- -

x01000000000000004bceb90109b6b0f300000000000000000000000000000000000000000000000

- -

0000000000000000000000000000000000000000000000000,0x0000000000000000000000000000

- -

00000000000000000000000000000000000000000000000000000000000000000000000000000000

- -

00000000000000000000,0x4765526f

- -

     [java] -Wed Sep 19 17:09:45 IST 2007 DEBUG: Executing XA statement: XA PREPA

- -

RE 0x01000000000000004bceb90109b6b0f30000000000000000000000000000000000000000000

- -

00000000000000000000000000000000000000000000000000000,0x000000000000000000000000

- -

00000000000000000000000000000000000000000000000000000000000000000000000000000000

- -

000000000000000000000000,0x4765526f

- -

     [java] -Wed Sep 19 17:09:45 IST 2007 DEBUG: Executing XA statement: XA COMMI

- -

T 0x01000000000000004bceb90109b6b0f300000000000000000000000000000000000000000000

- -

0000000000000000000000000000000000000000000000000000,0x0000000000000000000000000

- -

00000000000000000000000000000000000000000000000000000000000000000000000000000000

- -

00000000000000000000000,0x4765526f

- -

     [java] -After transaction, table is:

- -

     [java]     id      -name    balance

- -

     [java]     1       -John Feng       0

- -

     [java]     2       -John Feng       1200

- -

     [java] -Cleanup

- -

     [java] -End MoneyTransfer

- -

     [java]

- -

 

- -

BUILD SUCCESSFUL

- -

Total time: 8 seconds

- -
- -

Observation: The build.xml ant file only works on DAS Java binary -distribution.

- -
- - - - diff --git a/java/das/samples/transaction/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetupUtil.java b/java/das/samples/transaction/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetupUtil.java deleted file mode 100644 index fbcbe1a5f7..0000000000 --- a/java/das/samples/transaction/src/main/java/org/apache/tuscany/samples/das/databaseSetup/DatabaseSetupUtil.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.samples.das.databaseSetup; - -import java.sql.Connection; -import java.sql.ResultSet; - -import org.apache.tuscany.das.rdb.dbconfig.DBConfig; -import org.apache.tuscany.das.rdb.dbconfig.DBConfigUtil; -import org.apache.tuscany.das.rdb.dbconfig.DBInitializer; -import org.apache.tuscany.samples.das.tx.manager.GeronimoTransactionManagerUtil; - -/** - * Setup database, XA resources required by the sample - * - * - */ -public class DatabaseSetupUtil { - private static DBConfig dbConfig = null; - /** - * Constructor for DatabaseSetupUtil. - */ - public DatabaseSetupUtil(String dbConfigFile) throws Exception { - //create database tables, data - DBInitializer dbInitializer = new DBInitializer(dbConfigFile); - dbInitializer.refreshDatabaseData(); - //read DAS Config - dbConfig = DBConfigUtil.loadDBConfig(ClassLoader.getSystemResourceAsStream(dbConfigFile)); - } - - public static DBConfig getDBConfig() { - return DatabaseSetupUtil.dbConfig; - } - - public static void main(String[] args) throws Exception{ - //test program - new DatabaseSetupUtil("BankAccountDBConfig.xml"); - GeronimoTransactionManagerUtil tmUtil = new GeronimoTransactionManagerUtil(); - tmUtil.initTransactionManager(); - tmUtil.startTransaction(); - Connection conn = tmUtil.getConnection(); - - ResultSet rs = conn.createStatement().executeQuery("select id, balance from bankaccount"); - while(rs.next()){ - System.out.println("result row: "+rs.getInt(1)+","+rs.getString(2)); - } - - tmUtil.commitTransaction(); - - } -} diff --git a/java/das/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerService.java b/java/das/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerService.java deleted file mode 100644 index ee106bec0c..0000000000 --- a/java/das/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerService.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.samples.das.tx.manager; - -import javax.transaction.HeuristicMixedException; -import javax.transaction.HeuristicRollbackException; -import javax.transaction.InvalidTransactionException; -import javax.transaction.NotSupportedException; -import javax.transaction.RollbackException; -import javax.transaction.SystemException; -import javax.transaction.Transaction; -import javax.transaction.TransactionManager; - -import org.apache.geronimo.transaction.manager.TransactionManagerImpl; -import org.apache.geronimo.transaction.manager.XidFactoryImpl; - -/** - * A TransactionManager that delegates to a Geronimo JTA transaction manager. This class serves as a - * wrapper for initializing the Geronimo TM as a system service. - * - * @version $Rev$ $Date$ - */ -public class GeronimoTransactionManagerService implements TransactionManager { - private TransactionManager transactionManager; - private int timeout = 250; - - public GeronimoTransactionManagerService() { - } - - /** - * Returns the transaction timeout in seconds - * - * @return the transaction timeout in seconds - */ - public int getTimeout() { - return timeout; - } - - /** - * Sets the transaction timeout in seconds - */ - public void setTimeout(int timeout) { - this.timeout = timeout; - } - - public void init() throws Exception { - XidFactoryImpl factory = new XidFactoryImpl(); - transactionManager = new TransactionManagerImpl(timeout, factory, null); - } - - public void begin() throws NotSupportedException, SystemException { - transactionManager.begin(); - } - - public void commit() throws HeuristicMixedException, - HeuristicRollbackException, - IllegalStateException, - RollbackException, - SecurityException, - SystemException { - transactionManager.commit(); - } - - public TransactionManager getTransactionManager() { - return transactionManager; - } - - public int getStatus() throws SystemException { - return transactionManager.getStatus(); - } - - public Transaction getTransaction() throws SystemException { - return transactionManager.getTransaction(); - } - - public void resume(Transaction transaction) - throws IllegalStateException, InvalidTransactionException, SystemException { - transactionManager.resume(transaction); - } - - public void rollback() throws IllegalStateException, SecurityException, SystemException { - transactionManager.rollback(); - } - - public void setRollbackOnly() throws IllegalStateException, SystemException { - transactionManager.setRollbackOnly(); - } - - public void setTransactionTimeout(int i) throws SystemException { - transactionManager.setTransactionTimeout(i); - } - - public Transaction suspend() throws SystemException { - return transactionManager.suspend(); - } - - public void begin(long timeout) throws NotSupportedException, SystemException { - transactionManager.begin(); - return; - } - -} diff --git a/java/das/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerUtil.java b/java/das/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerUtil.java deleted file mode 100644 index 084e735117..0000000000 --- a/java/das/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/manager/GeronimoTransactionManagerUtil.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.samples.das.tx.manager; - -import java.sql.Connection; -import java.sql.SQLException; - -import javax.sql.XAConnection; -import javax.sql.XADataSource; -import javax.transaction.xa.XAResource; -import javax.transaction.xa.Xid; - -import org.apache.geronimo.transaction.manager.XidFactory; -import org.apache.geronimo.transaction.manager.XidFactoryImpl; -import org.apache.tuscany.das.rdb.dbconfig.DBConfig; -import org.apache.tuscany.samples.das.databaseSetup.DatabaseSetupUtil; - -import com.mysql.jdbc.jdbc2.optional.MysqlXADataSource; - -public class GeronimoTransactionManagerUtil { - private GeronimoTransactionManagerService service; - private static XADataSource xads; - private static XAConnection xaconn = null; - private static XAResource xares = null; - private static XidFactory xidFact = null; - private static Xid xid = null; - - public void initTransactionManager() { - // Get a transction manager - try { - xidFact = new XidFactoryImpl(); - // creates an instance of Geronimo TM Service - service = new GeronimoTransactionManagerService(); - service.init(); - service.begin(); - initDataSource(); - initXAConnection(); - } catch (Exception e) { - e.printStackTrace(); - System.exit(1); - } - } - - private void initDataSource() { - //setup XADataSource - xads = new MysqlXADataSource(); - try { - DBConfig dbcfg = DatabaseSetupUtil.getDBConfig(); - ((MysqlXADataSource) xads).setUser(dbcfg.getConnectionInfo().getConnectionProperties().getUserName()); - ((MysqlXADataSource) xads).setPassword(dbcfg.getConnectionInfo().getConnectionProperties().getPassword()); - ((MysqlXADataSource) xads).setUrl(dbcfg.getConnectionInfo().getConnectionProperties().getDatabaseURL()); - ((MysqlXADataSource) xads).setURL(dbcfg.getConnectionInfo().getConnectionProperties().getDatabaseURL()); - } catch (Exception e) { - e.printStackTrace(); - System.exit(1); - } - } - - private void initXAConnection() throws SQLException{ - DBConfig dbcfg = DatabaseSetupUtil.getDBConfig(); - xaconn = xads.getXAConnection(dbcfg.getConnectionInfo().getConnectionProperties().getUserName(), - dbcfg.getConnectionInfo().getConnectionProperties().getPassword()); - } - - public void startTransaction() throws Exception { - try{ - //create XAResource - xid= xidFact.createXid(); - xares = xaconn.getXAResource(); - xares.setTransactionTimeout(250); //something - xares.start(xid, XAResource.TMNOFLAGS); - return; - }catch(Exception e) { - e.printStackTrace(); - throw e; - } - } - - public void commitTransaction() throws Exception { - xares.end(xid, XAResource.TMSUCCESS); - xares.prepare(xid); - xares.commit(xid, false); //onePhase=true/false - } - - public void rollbackTransaction() throws Exception { - xares.end(xid, XAResource.TMFAIL); - xares.prepare(xid); - xares.rollback(xid); - } - - public Connection getConnection() throws SQLException { - return xaconn.getConnection(); - } - - /** - * cleanup - */ - public void cleanup() throws Exception{ - xaconn.close(); - xid = null; - xares = null; - xaconn = null; - xads = null; - service.commit(); - } -} diff --git a/java/das/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/sample/MoneyTransfer.java b/java/das/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/sample/MoneyTransfer.java deleted file mode 100644 index 650f60f089..0000000000 --- a/java/das/samples/transaction/src/main/java/org/apache/tuscany/samples/das/tx/sample/MoneyTransfer.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.samples.das.tx.sample; - -import java.io.InputStream; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.Statement; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.samples.das.databaseSetup.DatabaseSetupUtil; -import org.apache.tuscany.samples.das.tx.manager.GeronimoTransactionManagerUtil; - -import commonj.sdo.DataObject; - -/** - * Sample using Geronimo TM to execute multiple DAS applyChanges() under one transaction. - * - */ -public class MoneyTransfer { - - private static final String USAGE = "usage: java MoneyTransfer [commit|rollback] [transferAmount]"; - private static final String SQL_REQUEST = "select id, name, balance from bankaccount"; - private static Connection conn = null; - private static DAS das = null; - - private static void printTable() { - try { - Statement stmt = conn.createStatement(); - ResultSet rset = stmt.executeQuery(SQL_REQUEST); - int numcols = rset.getMetaData().getColumnCount(); - for (int i = 1; i <= numcols; i++) { - System.out.print("\t" + rset.getMetaData().getColumnName(i)); - } - System.out.println(); - while (rset.next()) { - for (int i = 1; i <= numcols; i++) { - System.out.print("\t" + rset.getString(i)); - } - System.out.println(""); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void main(String[] args) { - GeronimoTransactionManagerUtil tmUtil = null; - - if (args.length != 2 || (!args[0].equals("commit") && !args[0].equals("rollback"))) { - System.out.println(USAGE + "\n"); - System.exit(1); - } - - String completion = args[0]; - float transferAmount = 0; - try { - transferAmount = Float.parseFloat(args[1]); - } catch (NumberFormatException e) { - System.out.println(USAGE); - System.out.println("[transferAmount] has to be a float\n"); - System.exit(1); - } - - System.out.println("INIT database"); - try{ - new DatabaseSetupUtil("BankAccountDBConfig.xml"); - }catch(Exception e){ - e.printStackTrace(); - System.exit(1); - } - - try { - System.out.println("INIT transaction manager"); - tmUtil = new GeronimoTransactionManagerUtil(); - tmUtil.initTransactionManager(); - tmUtil.startTransaction(); - } catch (Exception e) { - System.out.println("Exception of type :" + e.getClass().getName() + " has been thrown"); - System.out.println("Exception message :" + e.getMessage()); - e.printStackTrace(); - System.exit(1); - } - - try { - System.out.println("Get a connection"); - conn = tmUtil.getConnection(); - conn.setAutoCommit(false); - } catch (Exception e) { - e.printStackTrace(); - } - - System.out.println("Before transaction, table is:"); - printTable(); - - try { - System.out.println("Begin a transaction"); - init(); //initialize DAS instance - System.out.println("Update the table - 2 accounts"); - withdrawFromBankAccount1(transferAmount); - depositToBankAccount2(transferAmount); - - if (completion.equals("commit")) { - System.out.println("*commit* the transaction"); - tmUtil.commitTransaction(); - } else { - System.out.println("*rollback* the transaction"); - tmUtil.rollbackTransaction(); - } - } catch (Exception e) { - System.out.println("Exception of type :" + e.getClass().getName() + " has been thrown"); - System.out.println("Exception message :" + e.getMessage()); - e.printStackTrace(); - System.exit(1); - } - - System.out.println("After transaction, table is:"); - printTable(); - - System.out.println("Cleanup"); - try { - tmUtil.cleanup(); - } catch (Exception e) { - e.printStackTrace(); - } - - System.out.println("End MoneyTransfer\n"); - System.exit(0); - } - - private static void init(){ - try{ - das = DAS.FACTORY.createDAS(getConfig("BankAccounts.xml"), conn); - }catch(Exception e){ - e.printStackTrace(); - } - } - - /** - * Withdraw asked amount from account1 - * @return - */ - public static final void withdrawFromBankAccount1(float transferAmount) { - Command read = das.getCommand("BankAccount1Data"); - DataObject root = read.executeQuery(); - DataObject account1 = (DataObject)root.getList("BANKACCOUNT").get(0); - float currentBalance = account1.getFloat("BALANCE"); - float newBalance = currentBalance - transferAmount; - account1.setFloat("BALANCE", newBalance); - das.applyChanges(root); - } - - /** - * Deposit asked amount into account2 - * @return - */ - public static final void depositToBankAccount2(float transferAmount) { - Command read = das.getCommand("BankAccount2Data"); - DataObject root = read.executeQuery(); - DataObject account2 = (DataObject)root.getList("BANKACCOUNT").get(0); - float currentBalance = account2.getFloat("BALANCE"); - float newBalance = currentBalance + transferAmount; - account2.setFloat("BALANCE", newBalance); - das.applyChanges(root); - } - - /**Utilities - * - * @param fileName - * @return - */ - private static InputStream getConfig(String fileName) { - MoneyTransfer jdbcExample = new MoneyTransfer(); - return jdbcExample.getClass().getClassLoader().getResourceAsStream(fileName); - } -} diff --git a/java/das/samples/transaction/src/main/resources/BankAccountDBConfig.xml b/java/das/samples/transaction/src/main/resources/BankAccountDBConfig.xml deleted file mode 100644 index 1ade9f2341..0000000000 --- a/java/das/samples/transaction/src/main/resources/BankAccountDBConfig.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - 1, 'John Feng', 1200 - 2, 'John Feng', 0 -
- -
diff --git a/java/das/samples/transaction/src/main/resources/BankAccounts.xml b/java/das/samples/transaction/src/main/resources/BankAccounts.xml deleted file mode 100644 index 09c1a5bb04..0000000000 --- a/java/das/samples/transaction/src/main/resources/BankAccounts.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - -
- -
diff --git a/java/das/tools/pom.xml b/java/das/tools/pom.xml deleted file mode 100644 index 384ed64c62..0000000000 --- a/java/das/tools/pom.xml +++ /dev/null @@ -1,147 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.das - tuscany-das - 1.0-SNAPSHOT - - - tuscany-das-tools - Tuscany DAS Tools for Relational Databases - - - - org.apache.tuscany.das - tuscany-das-rdb - ${das.version} - compile - - - - org.apache.tuscany.das.samples - tuscany-das-sample-dbconfig - ${das.version} - compile - - - org.apache.derby - derby - - - - - - org.apache.tuscany.sdo - tuscany-sdo-api-r2.1 - ${sdo.version} - - - - org.apache.tuscany.sdo - tuscany-sdo-impl - ${sdo.version} - - - - org.apache.tuscany.sdo - tuscany-sdo-lib - ${sdo.version} - - - - stax - stax-api - 1.0.1 - - - - org.apache.derby - derby - 10.2.2.0 - test - - - - log4j - log4j - 1.2.14 - compile - - - - junit - junit - 3.8.1 - test - - - - torque - torque-gen - 3.3-RC2 - - - - - - tuscany-das-tools - src/main/java - - - src/main/java - - - src/main/resources - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - true - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - **/*Tests.java - - - - - - - - - - - - diff --git a/java/das/tools/readme.htm b/java/das/tools/readme.htm deleted file mode 100644 index 9465dc323e..0000000000 --- a/java/das/tools/readme.htm +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - -Tuscany DAS Tools - - - - - -

Tuscany DAS Tools

-

Building DAS Tools

- -DBToXSDGenerator provides utility methods for use when DB Schema is available and SDO Model xsds are not. This
-utility will help build SDO Model xsds based on DB Schema. These xsds can be supplied to Data Access Service
-like (RDB-DAS) to have SDO <-> DB data exchange.
- -
-
    -
  • getModelFileFromDB(String dbInfoFile) - connect to database and convert DB Schema to XSD Model XSDs
  • -
  • getModelFileFromSchemaFile(String schemaFileName, String SDOModelFileName) - no DB Connection needed, but need Apache Torque output of DB schema file
  • -
  • getSchemaFileFromDB(String dbInfoFile) - connect to database and use Apache Torque to get DB Schema xml file
  • -
  • getModelFileFromDB(ModelXSDGenOption mo) - connect to database and convert DB Schema to XSD Model XSDs
  • -
  • getModelFileFromSchemaFile(ModelXSDGenOption mo) - no DB Connection needed, but need Apache Torque output of DB schema file
  • -
  • ModelXSDGenOption holds - schemaFile, modelFile, driverClass, databaseURL, schemaName, userName, password
  • -
- -To build the Tuscany DAS DBToXSDGenerator tool, perform the following steps
-
    -
  • Ensure that the environment variable JAVA_HOME is set to point to an installation of Java 1.4 JDK
  • -
  • --->To run as a maven plugin, run the command "mvn"
  • -
  • --->To run as a standalone tool, call the above listed methods from DBToXSDGenerator
  • -
- -Assumption Database exists and contains required tables, constraints. Required Driver jar is in classpath
- -
    - Example dbInfoFile
    - <Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd">
    -
    - <!--Uncomment below for derby test-->
    - <ConnectionInfo>
    -   <ConnectionProperties
    -     driverClass="org.apache.derby.jdbc.EmbeddedDriver"
    -     databaseURL="jdbc:derby:target/dastest"
    -     schemaName = "APP"
    -     loginTimeout="600000"/>
    - </ConnectionInfo>

    - <OutFiles
    -   schemaFile="target/dbSchema.txt"
    -   modelFile="target/schemaModel.xsd"
    - />
    -</Config> -
- diff --git a/java/das/tools/src/main/java/org/apache/tuscany/das/rdb/util/Column.java b/java/das/tools/src/main/java/org/apache/tuscany/das/rdb/util/Column.java deleted file mode 100644 index cbadde0717..0000000000 --- a/java/das/tools/src/main/java/org/apache/tuscany/das/rdb/util/Column.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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; - -public class Column { - private String name; - private String type; - private boolean isPK; - private boolean isRequired; - - protected String getName() { - return name; - } - protected void setName(String name) { - this.name = name; - } - protected String getType() { - return type; - } - protected void setType(String type) { - this.type = type; - } - protected boolean isPK() { - return isPK; - } - protected void setPK(boolean isPK) { - this.isPK = isPK; - } - protected boolean isRequired() { - return isRequired; - } - protected void setRequired(boolean isRequired) { - this.isRequired = isRequired; - } - - public String toString() { - StringBuffer dbSchemaStr = new StringBuffer(); - dbSchemaStr.append("Name:"+this.getName()+", Type:"+this.getType()+", isPK:"+this.isPK()+", isRequired:"+this.isRequired()+"\n"); - return dbSchemaStr.toString(); - } -} diff --git a/java/das/tools/src/main/java/org/apache/tuscany/das/rdb/util/DBSchema.java b/java/das/tools/src/main/java/org/apache/tuscany/das/rdb/util/DBSchema.java deleted file mode 100644 index 4ae038b24d..0000000000 --- a/java/das/tools/src/main/java/org/apache/tuscany/das/rdb/util/DBSchema.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.ArrayList; -import java.util.List; - -public class DBSchema { - private List tables = new ArrayList(); - - protected List getTables() { - return tables; - } - - protected void setTables(List tables) { - this.tables = tables; - } - - public String toString() { - StringBuffer dbSchemaStr = new StringBuffer(); - dbSchemaStr.append("_____DB SChema_______\n"); - for(int i=0; i\n"; - String endLine = ""; - - if(xsdModelFileName != null && !xsdModelFileName.trim().equals("")) { - writeFilesToDir = true; - } - - //get all FKs to form a Map - PKtable -> FKTable , e.g. if CITIES has FK such that CITIES.STATE_ID is STATES.ID, then - //the map shall have STATES -> CITIES, TABLE2,... - Hashtable pkTofkTable = new Hashtable(); - - for(int i=0; i\n"; - srcCode = srcCode + " \n"; - - for(int j=0; j\n"; - } - - if(pkTofkTable.get(curTable.getName()) != null) { - ArrayList fkTables = (ArrayList)pkTofkTable.get(curTable.getName()); - - for(int k=0; k\n"; - } - } - - srcCode = srcCode + " \n"; - srcCode = srcCode + "\n\n"; - } - - srcCode = srcCode + endLine; - - File javaFile = new File(xsdModelFileName); - javaFile.createNewFile(); - PrintStream flStrm = new PrintStream(javaFile); - - if(writeFilesToDir) { - flStrm.print(srcCode); - flStrm.flush(); - flStrm.close(); - } else { - System.out.print(srcCode); - } - } -} \ No newline at end of file diff --git a/java/das/tools/src/main/java/org/apache/tuscany/das/rdb/util/Table.java b/java/das/tools/src/main/java/org/apache/tuscany/das/rdb/util/Table.java deleted file mode 100644 index c41085cf2f..0000000000 --- a/java/das/tools/src/main/java/org/apache/tuscany/das/rdb/util/Table.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.ArrayList; -import java.util.List; - -public class Table { - private String name; - private List columns = new ArrayList(); - private List fks = new ArrayList(); - - protected String getName() { - return name; - } - protected void setName(String name) { - this.name = name; - } - protected List getColumns() { - return columns; - } - protected void setColumns(List columns) { - this.columns = columns; - } - protected List getFks() { - return fks; - } - protected void setFks(List fks) { - this.fks = fks; - } - - public String toString() { - StringBuffer dbSchemaStr = new StringBuffer(); - dbSchemaStr.append("_____Table_______"+this.name+"\n"); - dbSchemaStr.append("_____Columns_______\n"); - for(int i=0; i 0) - dbSchemaStr.append("_____FKs_______\n"); - for(int i=0; i"; - String compare2 = ""; - String compare3 = ""; - String compare4 = ""; - - public void testDBToSchemaFile() throws Exception { - DBToXSDGenerator.getSchemaFileFromDB("DBConnectionConfig.xml"); - File file = new File("target/dbSchema.txt"); - if(file.isFile()) { - String schemaContent = getContents(file); - if(schemaContent.indexOf(compare1) != -1 && schemaContent.indexOf(compare2) != -1) { - assertTrue(true); - } - } else { - fail("SchemaFile does not exists or has improper contents!"); - } - } - - public void testSchemaFileToXSD() throws Exception { - DBToXSDGenerator.getModelFileFromSchemaFile("target/dbSchema.txt", "target/schemaModel.xsd"); - - File modelfile = new File("target/schemaModel.xsd"); - if(modelfile.isFile()) { - String modelContent = getContents(modelfile); - if(modelContent.indexOf(compare3) != -1 && modelContent.indexOf(compare4) != -1) { - assertTrue(true); - } - } else { - fail("ModelFile does not exists or has improper contents!"); - } - } - - public void testDBToXSD() throws Exception { - DBToXSDGenerator.getModelFileFromDB("DBConnectionConfig.xml"); - - File file = new File("target/dbSchema.txt"); - if(file.isFile()) { - String schemaContent = getContents(file); - if(schemaContent.indexOf(compare1) != -1 && schemaContent.indexOf(compare2) != -1) { - assertTrue(true); - } - } else { - fail("SchemaFile does not exists or has improper contents!"); - } - - File modelfile = new File("target/schemaModel.xsd"); - if(modelfile.isFile()) { - String modelContent = getContents(modelfile); - if(modelContent.indexOf(compare3) != -1 && modelContent.indexOf(compare4) != -1) { - assertTrue(true); - } - } else { - fail("ModelFile does not exists or has improper contents!"); - } - } -} diff --git a/java/das/tools/src/test/resources/DBConnectionConfig.xml b/java/das/tools/src/test/resources/DBConnectionConfig.xml deleted file mode 100644 index c00bd462db..0000000000 --- a/java/das/tools/src/test/resources/DBConnectionConfig.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - diff --git a/java/das/tools/src/test/resources/dbConfig.xml b/java/das/tools/src/test/resources/dbConfig.xml deleted file mode 100644 index b990d5cd0f..0000000000 --- a/java/das/tools/src/test/resources/dbConfig.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - -
-
- -
- -- cgit v1.2.3